Sha256: f10aaf40a2a017b1d75603c15b642b86d347d1101e26920acf73e7be0a332df4
Contents?: true
Size: 1.63 KB
Versions: 1
Compression:
Stored size: 1.63 KB
Contents
require 'set_partition' describe SetPartition::Generator do it "generate all possibility set forward" do set_partition = SetPartition::Generator.new 4 set_partition.start.should eql [0,0,0,0] set_partition.next.should eql [0,0,0,1] set_partition.next.should eql [0,0,1,0] set_partition.next.should eql [0,0,1,1] set_partition.next.should eql [0,0,1,2] set_partition.next.should eql [0,1,0,0] set_partition.next.should eql [0,1,0,1] set_partition.next.should eql [0,1,0,2] set_partition.next.should eql [0,1,1,0] set_partition.next.should eql [0,1,1,1] set_partition.next.should eql [0,1,1,2] set_partition.next.should eql [0,1,2,0] set_partition.next.should eql [0,1,2,1] set_partition.next.should eql [0,1,2,2] set_partition.next.should eql [0,1,2,3] set_partition.next.should be_nil end it "generate all possibility set backward" do set_partition = SetPartition::Generator.new 4 set_partition.end.should eql [0,1,2,3] set_partition.prev.should eql [0,1,2,2] set_partition.prev.should eql [0,1,2,1] set_partition.prev.should eql [0,1,2,0] set_partition.prev.should eql [0,1,1,2] set_partition.prev.should eql [0,1,1,1] set_partition.prev.should eql [0,1,1,0] # set_partition.prev.should eql [0,1,0,2] set_partition.prev.should eql [0,1,0,1] set_partition.prev.should eql [0,1,0,0] set_partition.prev.should eql [0,0,1,2] set_partition.prev.should eql [0,0,1,1] set_partition.prev.should eql [0,0,1,0] set_partition.prev.should eql [0,0,0,1] set_partition.prev.should eql [0,0,0,0] set_partition.prev.should be_nil end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
set_partition-0.0.1 | spec/set_partition/generator_spec.rb |