Sha256: 653de16d50571fcf0c9e05e4ed662f6785e071e8e9a1dc4a6f7532c5b5e190fd
Contents?: true
Size: 790 Bytes
Versions: 9
Compression:
Stored size: 790 Bytes
Contents
# A034386 PRIMORIAL = [1,2,6,6,30,30,210,210,210,210,2310,2310,30030, 30030,30030,30030,510510,510510,9699690,9699690, 9699690,9699690,223092870,223092870,223092870, 223092870,223092870,223092870,6469693230, 6469693230] describe Integer, "#primorial" do PRIMORIAL.each_with_index do |n,i| i = i.succ it "should return #{n} for #{i}" do i.primorial.should == n end end end describe Integer, "#primorial?" do PRIMORIAL.uniq.each do |n| it "should return true for primorial number #{n}" do n.should be_primorial end end ((1..PRIMORIAL.last).first(20) - PRIMORIAL).uniq.each do |n| it "should return false for non-primorial number #{n}" do n.should_not be_primorial end end end
Version data entries
9 entries across 9 versions & 1 rubygems