combinatorics 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,117 +6,117 @@ describe Permute do
6
6
 
7
7
  describe "cardinality" do
8
8
  it "should raise RangeError if n is negative without passing r" do
9
- lambda { subject.cardinality(-1) }.should raise_error(RangeError)
9
+ expect { subject.cardinality(-1) }.to raise_error(RangeError)
10
10
  end
11
11
 
12
12
  it "should raise RangeError if n is negative when r is provided" do
13
- lambda { subject.cardinality(-1, 1) }.should raise_error(RangeError)
13
+ expect { subject.cardinality(-1, 1) }.to raise_error(RangeError)
14
14
  end
15
15
 
16
16
  it "should raise RangeError if r is negative" do
17
- lambda { subject.cardinality(1, -1) }.should raise_error(RangeError)
17
+ expect { subject.cardinality(1, -1) }.to raise_error(RangeError)
18
18
  end
19
19
 
20
20
  it "should raise RangeError if r is greater than n" do
21
- lambda { subject.cardinality(2, 3) }.should raise_error(RangeError)
21
+ expect { subject.cardinality(2, 3) }.to raise_error(RangeError)
22
22
  end
23
23
 
24
24
  it "should return 1 for subject.cardinality(0)" do
25
- subject.cardinality(0).should == 1
25
+ expect(subject.cardinality(0)).to eq(1)
26
26
  end
27
27
 
28
28
  it "should return 1 for subject.cardinality(1)" do
29
- subject.cardinality(1).should == 1
29
+ expect(subject.cardinality(1)).to eq(1)
30
30
  end
31
31
 
32
32
  it "should return 2 for subject.cardinality(2)" do
33
- subject.cardinality(2).should == 2
33
+ expect(subject.cardinality(2)).to eq(2)
34
34
  end
35
35
 
36
36
  it "should return 6 for subject.cardinality(3)" do
37
- subject.cardinality(3).should == 6
37
+ expect(subject.cardinality(3)).to eq(6)
38
38
  end
39
39
 
40
40
  it "should return 24 for subject.cardinality(4)" do
41
- subject.cardinality(4).should == 24
41
+ expect(subject.cardinality(4)).to eq(24)
42
42
  end
43
43
 
44
44
  it "should return 0 for subject.cardinality(1, 0)" do
45
- subject.cardinality(1, 0).should == 0
45
+ expect(subject.cardinality(1, 0)).to eq(0)
46
46
  end
47
47
 
48
48
  it "should return 1 for subject.cardinality(1, 1)" do
49
- subject.cardinality(1, 1).should == 1
49
+ expect(subject.cardinality(1, 1)).to eq(1)
50
50
  end
51
51
 
52
52
  it "should return 2 for subject.cardinality(2, 1)" do
53
- subject.cardinality(2, 1).should == 2
53
+ expect(subject.cardinality(2, 1)).to eq(2)
54
54
  end
55
55
 
56
56
  it "should return 1 for subject.cardinality(2, 2)" do
57
- subject.cardinality(2, 2).should == 2
57
+ expect(subject.cardinality(2, 2)).to eq(2)
58
58
  end
59
59
 
60
60
  it "should return 3 for subject.cardinality(3, 1)" do
61
- subject.cardinality(3, 1).should == 3
61
+ expect(subject.cardinality(3, 1)).to eq(3)
62
62
  end
63
63
 
64
64
  it "should return 3 for subject.cardinality(3, 2)" do
65
- subject.cardinality(3, 2).should == 6
65
+ expect(subject.cardinality(3, 2)).to eq(6)
66
66
  end
67
67
 
68
68
  it "should return 1 for subject.cardinality(3, 3)" do
69
- subject.cardinality(3, 3).should == 6
69
+ expect(subject.cardinality(3, 3)).to eq(6)
70
70
  end
71
71
 
72
72
  it "should return 4 for subject.cardinality(4, 1)" do
73
- subject.cardinality(4, 1).should == 4
73
+ expect(subject.cardinality(4, 1)).to eq(4)
74
74
  end
75
75
 
76
76
  it "should return 12 for subject.cardinality(4, 2)" do
77
- subject.cardinality(4, 2).should == 12
77
+ expect(subject.cardinality(4, 2)).to eq(12)
78
78
  end
79
79
 
80
80
  it "should return 24 for subject.cardinality(4, 3)" do
81
- subject.cardinality(4, 3).should == 24
81
+ expect(subject.cardinality(4, 3)).to eq(24)
82
82
  end
83
83
 
84
84
  it "should return 1 for subject.cardinality(4, 4)" do
85
- subject.cardinality(4, 4).should == 24
85
+ expect(subject.cardinality(4, 4)).to eq(24)
86
86
  end
87
87
 
88
88
  it "should return 360 for subject.cardinality(6, 4)" do
89
- subject.cardinality(6, 4).should == 360
89
+ expect(subject.cardinality(6, 4)).to eq(360)
90
90
  end
91
91
 
92
92
  it "should return 3628800 for subject.cardinality(10)" do
93
- subject.cardinality(10).should == 3628800
93
+ expect(subject.cardinality(10)).to eq(3628800)
94
94
  end
95
95
  end
96
96
 
97
97
  describe "cardinality_all" do
98
98
  it "should return [] for cardinality_all(0)" do
99
- subject.cardinality_all(0).should be_empty
99
+ expect(subject.cardinality_all(0)).to be_empty
100
100
  end
101
101
 
102
102
  it "should return [1] for cardinality_all(1)" do
103
- subject.cardinality_all(1).should == [1]
103
+ expect(subject.cardinality_all(1)).to eq([1])
104
104
  end
105
105
 
106
106
  it "should return [2, 1] for cardinality_all(2)" do
107
- subject.cardinality_all(2).should == [2, 2]
107
+ expect(subject.cardinality_all(2)).to eq([2, 2])
108
108
  end
109
109
 
110
110
  it "should return [3, 6, 1] for cardinality_all(3)" do
111
- subject.cardinality_all(3).should == [3, 6, 6]
111
+ expect(subject.cardinality_all(3)).to eq([3, 6, 6])
112
112
  end
113
113
 
114
114
  it "should return [4, 12, 24, 1] for cardinality_all(4)" do
115
- subject.cardinality_all(4).should == [4, 12, 24, 24]
115
+ expect(subject.cardinality_all(4)).to eq([4, 12, 24, 24])
116
116
  end
117
117
 
118
118
  it "should raise RangeError for cardinality_all(-1)" do
119
- lambda { subject.cardinality_all(-1) }.should raise_error(RangeError)
119
+ expect { subject.cardinality_all(-1) }.to raise_error(RangeError)
120
120
  end
121
121
 
122
122
  it "should wrap cardinality with Permute.N" do
@@ -8,35 +8,35 @@ shared_examples_for "Permute::Mixin" do
8
8
  set = subject[]
9
9
  results = set.permute(0).to_a
10
10
 
11
- results.should == [[]]
11
+ expect(results).to eq([[]])
12
12
  end
13
13
 
14
14
  it "should return [[]] for [1].permute(0).to_a" do
15
15
  set = subject[1]
16
16
  results = set.permute(0).to_a
17
17
 
18
- results.should == [[]]
18
+ expect(results).to eq([[]])
19
19
  end
20
20
 
21
21
  it "should return [[1]] for [1].permute(1).to_a" do
22
22
  set = subject[1]
23
23
  results = set.permute(1).to_a
24
24
 
25
- results.should == [[1]]
25
+ expect(results).to eq([[1]])
26
26
  end
27
27
 
28
28
  it "should return [[1], [2]] for [1, 2].permute(1).to_a" do
29
29
  set = subject[1, 2]
30
30
  results = set.permute(1).to_a
31
31
 
32
- results.should =~ [[1], [2]]
32
+ expect(results).to match_array([[1], [2]])
33
33
  end
34
34
 
35
35
  it "should return [[1, 2]] for [1, 2].permute(2).to_a" do
36
36
  set = subject[1, 2]
37
37
  results = set.permute(2).to_a
38
38
 
39
- results.should =~ [[1, 2], [2, 1]]
39
+ expect(results).to match_array([[1, 2], [2, 1]])
40
40
  end
41
41
  end
42
42
  end
@@ -8,13 +8,13 @@ shared_examples_for "PowerSet::Mixin" do
8
8
  it "the powerset of an empty Set should only contain the empty Set" do
9
9
  set = subject[]
10
10
 
11
- set.powerset.to_a.should == [empty_set]
11
+ expect(set.powerset.to_a).to eq([empty_set])
12
12
  end
13
13
 
14
14
  it "the powerset of a single Set should contain that Set" do
15
15
  set = subject[1]
16
16
 
17
- set.powerset.to_a.should == [empty_set, Set[*set]]
17
+ expect(set.powerset.to_a).to eq([empty_set, Set[*set]])
18
18
  end
19
19
 
20
20
  it "the powerset of a Set should all be subsets" do
@@ -23,12 +23,12 @@ shared_examples_for "PowerSet::Mixin" do
23
23
 
24
24
  set.powerset { |subset| superset += subset }
25
25
 
26
- superset.should == Set[*set]
26
+ expect(superset).to eq(Set[*set])
27
27
  end
28
28
 
29
29
  it "should alias powerset to power_set" do
30
30
  set = subject[1]
31
31
 
32
- set.should respond_to(:power_set)
32
+ expect(set).to respond_to(:power_set)
33
33
  end
34
34
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,4 @@
1
- gem 'rspec', '~> 2.4'
2
1
  require 'rspec'
3
-
4
2
  require 'combinatorics/version'
5
3
 
6
4
  include Combinatorics
metadata CHANGED
@@ -1,65 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: combinatorics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
5
- prerelease:
4
+ version: 0.4.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Postmodern
9
8
  - Duper
10
- autorequire:
9
+ autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-05-28 00:00:00.000000000 Z
12
+ date: 2022-01-17 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- name: rubygems-tasks
15
+ name: bundler
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ~>
18
+ - - "~>"
21
19
  - !ruby/object:Gem::Version
22
- version: '0.1'
20
+ version: '2.0'
23
21
  type: :development
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ~>
25
+ - - "~>"
29
26
  - !ruby/object:Gem::Version
30
- version: '0.1'
31
- - !ruby/object:Gem::Dependency
32
- name: rspec
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
- requirements:
36
- - - ~>
37
- - !ruby/object:Gem::Version
38
- version: '2.4'
39
- type: :development
40
- prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: '2.4'
47
- - !ruby/object:Gem::Dependency
48
- name: yard
49
- requirement: !ruby/object:Gem::Requirement
50
- none: false
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '0.7'
55
- type: :development
56
- prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ~>
61
- - !ruby/object:Gem::Version
62
- version: '0.7'
27
+ version: '2.0'
63
28
  description: A collection of modules and methods for performing Combinatoric calculations.
64
29
  email:
65
30
  - postmodern.mod3@gmail.com
@@ -72,13 +37,15 @@ extra_rdoc_files:
72
37
  - LICENSE.txt
73
38
  - README.md
74
39
  files:
75
- - .document
76
- - .gemtest
77
- - .gitignore
78
- - .rspec
79
- - .yardopts
40
+ - ".document"
41
+ - ".gemtest"
42
+ - ".github/workflows/ruby.yml"
43
+ - ".gitignore"
44
+ - ".rspec"
45
+ - ".yardopts"
80
46
  - Benchmarks.md
81
47
  - ChangeLog.md
48
+ - Gemfile
82
49
  - LICENSE.txt
83
50
  - README.md
84
51
  - Rakefile
@@ -157,26 +124,28 @@ files:
157
124
  homepage: https://github.com/postmodern/combinatorics#readme
158
125
  licenses:
159
126
  - MIT
160
- post_install_message:
127
+ metadata:
128
+ documentation_uri: https://rubydoc.info/gems/combinatorics
129
+ source_code_uri: https://github.com/postmodern/combinatorics.rb
130
+ bug_tracker_uri: https://github.com/postmodern/combinatorics.rb/issues
131
+ changelog_uri: https://github.com/postmodern/combinatorics.rb/blob/master/ChangeLog.md
132
+ post_install_message:
161
133
  rdoc_options: []
162
134
  require_paths:
163
135
  - lib
164
136
  required_ruby_version: !ruby/object:Gem::Requirement
165
- none: false
166
137
  requirements:
167
- - - ! '>='
138
+ - - ">="
168
139
  - !ruby/object:Gem::Version
169
140
  version: 1.8.7
170
141
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
142
  requirements:
173
- - - ! '>='
143
+ - - ">="
174
144
  - !ruby/object:Gem::Version
175
145
  version: '0'
176
146
  requirements: []
177
- rubyforge_project:
178
- rubygems_version: 1.8.24
179
- signing_key:
180
- specification_version: 3
147
+ rubygems_version: 3.2.22
148
+ signing_key:
149
+ specification_version: 4
181
150
  summary: Bringing (more) Combinatorics to Ruby
182
151
  test_files: []