Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

No need for zero?, 0.0 == 0.

  • Loading branch information...
commit d344f0444275aa6c465e66a886a82661798d8abf 1 parent 09430e3
@postmodern authored
View
2  lib/combinatorics/extensions/math.rb
@@ -169,7 +169,7 @@ def Math.subfactorial(n)
#
def Math.factorial(x=1)
if x >= 1 then pi(1..x)
- elsif x.zero? then 1
+ elsif x == 0 then 1
else
raise(RangeError,"x must be non-negative")
end
View
2  spec/choose/cardinality_spec.rb
@@ -42,7 +42,7 @@
end
it "should return 0 for subject.cardinality(1, 0)" do
- subject.cardinality(1, 0).should be_zero
+ subject.cardinality(1, 0).should == 0
end
it "should return 1 for subject.cardinality(1, 1)" do
View
2  spec/extensions/math_spec.rb
@@ -74,7 +74,7 @@
end
it "should return 0 for subfactorial(1)" do
- subject.subfactorial(1).should be_zero
+ subject.subfactorial(1).should == 0
end
it "should return 1 for subfactorial(2)" do
View
2  spec/permute/cardinality_spec.rb
@@ -42,7 +42,7 @@
end
it "should return 0 for subject.cardinality(1, 0)" do
- subject.cardinality(1, 0).should be_zero
+ subject.cardinality(1, 0).should == 0
end
it "should return 1 for subject.cardinality(1, 1)" do
Please sign in to comment.
Something went wrong with that request. Please try again.