Sha256: 5c290d3e4716e93c11ee8601ffca739efaa4aa5b29cc9d424352d9068eab170d
Contents?: true
Size: 578 Bytes
Versions: 2
Compression:
Stored size: 578 Bytes
Contents
describe Integer, "#hexagonal?" do # A000384 HEXAGONAL = [0,1,6,15,28,45,66,91,120,153,190,231,276,325,378, 435,496,561,630,703,780,861,946,1035,1128,1225, 1326,1431,1540,1653,1770,1891,2016,2145,2278,2415, 2556,2701,2850,3003,3160,3321,3486,3655,3828,4005, 4186,4371,4560] it "returns true for a hexagonal number" do HEXAGONAL.each{|n| n.should be_hexagonal} end it "returns false for a non-hexagonal number" do ((0..HEXAGONAL.last).to_a - HEXAGONAL).each{|n| n.should_not be_hexagonal} end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
numb-0.21.0 | spec/hexagonal_spec.rb |
numb-0.20.0 | spec/hexagonal_spec.rb |