Fix first Slot instruction that uses builder

now without method_missing and names
but still with instance_eval, hmm. Tried without, makes code much less readable
This commit is contained in:
2020-03-01 18:07:42 +02:00
parent 4888b3b6db
commit 4b303977a7
5 changed files with 22 additions and 13 deletions

View File

@ -7,18 +7,19 @@ module SlotMachine
TruthCheck.new(target , Label.new("ok" , "target"))
end
def test_len
assert_equal 8 , all.length , all_str
assert_equal 8 , all.length
assert_equal Risc::Label , all.first.class
end
def test_1_slot
assert_slot_to_reg risc(1) ,:r0 , 6 , :r2
assert_slot_to_reg risc(1) ,:message , 6 , :"message.caller"
end
def test_2_load
assert_load risc(2) , Parfait::FalseClass , :r3
assert_load risc(2) , Parfait::FalseClass
end
def test_3_op
assert_equal Risc::OperatorInstruction , risc(3).class
assert_equal :r3 , risc(3).left.symbol
assert_equal :r2 , risc(3).right.symbol
assert risc(3).left.is_object?
assert_equal :"message.caller" , risc(3).right.symbol
assert_equal :- , risc(3).operator
end
def test_4_zero
@ -26,12 +27,12 @@ module SlotMachine
assert_label risc(4).label , "target"
end
def test_5_load
assert_load risc(5) , Parfait::NilClass , :r3
assert_load risc(5) , Parfait::NilClass
end
def test_6_op
assert_equal Risc::OperatorInstruction , risc(6).class
assert_equal :r3 , risc(6).left.symbol
assert_equal :r2 , risc(6).right.symbol
assert risc(6).left.is_object?
assert_equal :"message.caller" , risc(6).right.symbol
assert_equal :- , risc(6).operator
end
def test_7_zero