redid integer comparison with builder

had to add some helpers to builder
This commit is contained in:
Torsten Ruger
2018-08-08 20:53:06 +03:00
parent fc6aa4e28b
commit 0d52b620ed
3 changed files with 49 additions and 19 deletions

View File

@ -14,7 +14,23 @@ module Risc
r1 = RegisterValue.new(:r1 , :Space)
@builder.build{ space << r1 }
assert_equal Transfer , @compiler.risc_instructions.next.class
assert_equal RegisterValue , @builder.space.class
end
def test_loads
@builder.build{ space << Parfait.object_space }
assert_equal LoadConstant , @compiler.risc_instructions.next.class
assert_equal RegisterValue , @builder.space.class
end
def test_two
@builder.build{ space << Parfait.object_space ; integer << 1}
assert_equal LoadConstant , @compiler.risc_instructions.next.class
assert_equal LoadData , @compiler.risc_instructions.next(2).class
end
def test_swap
test_two
@builder.swap_names( :space , :integer)
assert_equal :Integer , @builder.space.type.class_name
assert_equal :Space , @builder.integer.type.class_name
end
end
end