# kakuro-cross-sums / solver / ruby / t / check-perms.rb

 ```shl...@b384bcd7-… 06e0512 2008-09-19 shl...@b384bcd7-… 332ea12 2008-09-19 shl...@b384bcd7-… f1b19fb 2008-09-19 shl...@b384bcd7-… 8740260 2008-09-19 shl...@b384bcd7-… 06e0512 2008-09-19``` ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38``` ```require "kakuro-perms.rb" describe "Kakuro" do before do @perm = Kakuro::Perms.new end it "human->internal transform for 3/2" do @perm.human_to_internal(3,2).should eql([1,2]) end it "human->internal transform for 5/2" do @perm.human_to_internal(5,2).should eql([3,2]) end it "human->internal transform for 10/4" do # 10 = 1 + 2 + 3 + 4 # 10/int = 0 + 1 + 2 + 3 == 6 @perm.human_to_internal(10,4).should eql([6,4]) end it "internal->human transform for 1+2+3+4" do @perm.internal_to_human( (1 << (1-1)) | (1 << (2-1)) | (1 << (3-1)) | (1 << (4-1)) ).should eql([1,2,3,4]) end it "internal->human transform for 7+9" do @perm.internal_to_human( (1 << (7-1)) | (1 << (9-1)) ).should eql([7,9]) end it "10/4 is 1,2,3,4" do (@perm.get_perms(*@perm.human_to_internal(10,4)).map {|x| @perm.internal_to_human(x) }).should eql([[1,2,3,4]]) end end ```