ivar tests work

bit of slot find replace
This commit is contained in:
Torsten Ruger 2018-03-15 20:55:23 +05:30
parent 4a79d20a40
commit ff6d84a09b
10 changed files with 19 additions and 19 deletions

View File

@ -23,7 +23,7 @@ module Vool
assert_equal Mom::NotSameCheck , @first.condition.class , @first
end
def test_if_true_moves_type
assert_equal @first.if_true[0].class, Mom::SlotMove , @first.if_true.to_rxf
assert_equal @first.if_true[0].class, Mom::SlotLoad , @first.if_true.to_rxf
end
def test_if_true_resolves_setup
assert_equal @first.if_true[1].class , Mom::MessageSetup, @first.if_true.to_rxf
@ -35,7 +35,7 @@ module Vool
assert_equal @first.if_true[3].class , Mom::SimpleCall, @first.if_true.to_rxf
end
def test_if_true_resolves_move
assert_equal @first.if_true[4].class , Mom::SlotMove, @first.if_true.to_rxf
assert_equal @first.if_true[4].class , Mom::SlotLoad, @first.if_true.to_rxf
end
def test_setup_second
@ -51,7 +51,7 @@ module Vool
end
def test_array
check_array [SlotConstant,NotSameCheck,Label,SlotMove,MessageSetup,ArgumentTransfer,SimpleCall,SlotMove,Label,MessageSetup,ArgumentTransfer,DynamicCall] , @stats
check_array [SlotLoad,NotSameCheck,Label,SlotLoad,MessageSetup,ArgumentTransfer,SimpleCall,SlotLoad,Label,MessageSetup,ArgumentTransfer,DynamicCall] , @stats
end
end

View File

@ -20,7 +20,7 @@ module Vool
end
def test_arg_one
assert_equal Mom::SlotConstant, @stats[1].arguments[0].class
assert_equal Mom::SlotLoad, @stats[1].arguments[0].class
end
def test_call_two
assert_equal Mom::SimpleCall, @stats[2].class

View File

@ -32,7 +32,7 @@ module Vool
end
end
#otherwise as above, but assigning instance, so should get a SlotMove
#otherwise as above, but assigning instance, so should get a SlotLoad
class TestAssignMomInstanceToLocal < MiniTest::Test
include MomCompile
def setup

View File

@ -21,7 +21,7 @@ module Vool
assert_equal Mom::SlotDefinition , @first.condition.condition.class , @stats
end
def test_hoisetd
assert_equal Mom::SlotMove , @first.hoisted.class
assert_equal Mom::SlotLoad , @first.hoisted.class
end
end
end

View File

@ -27,7 +27,7 @@ module Vool
assert_nil @first.hoisted , @stats
end
def test_array
check_array [SlotMove,TruthCheck,Label,MessageSetup,ArgumentTransfer,SimpleCall,Label], @stats
check_array [SlotLoad,TruthCheck,Label,MessageSetup,ArgumentTransfer,SimpleCall,Label], @stats
end
end
end

View File

@ -6,32 +6,32 @@ module Vool
def setup
Risc.machine.boot
@method = compile_first_method( "@a = 5")
@ins = compile_first_method( "@a = 5")
end
def test_compiles_not_array
assert Array != @stats.class , @stats
end
def test_class_compiles
assert_equal Mom::SlotConstant , @method.first.class , @method
assert_equal Mom::SlotLoad , @ins.class , @ins
end
def test_slot_is_set
assert @method.first.left
assert @ins.left
end
def test_slot_starts_at_message
assert_equal :message , @method.first.left.known_object
assert_equal :message , @ins.left.known_object
end
def test_slot_gets_self
assert_equal :receiver , @method.first.left.slots[0]
assert_equal :receiver , @ins.left.slots[0]
end
def test_slot_assigns_to_local
assert_equal :a , @method.first.left.slots[-1]
assert_equal :a , @ins.left.slots[-1]
end
def test_slot_assigns_something
assert @method.first.right
assert @ins.right
end
def test_slot_assigns_int
assert_equal Mom::IntegerConstant , @method.first.right.class
assert_equal Mom::IntegerConstant , @ins.right.class
end
end
end

View File

@ -14,7 +14,7 @@ module Vool
assert Array != @stats.class , @stats
end
def test_class_compiles
assert_equal Mom::SlotConstant , @first.class , @stats
assert_equal Mom::SlotLoad , @first.class , @stats
end
def test_slot_is_set
assert @first.left

View File

@ -13,7 +13,7 @@ module Vool
assert Array != @stats.class , @stats
end
def test_class_compiles
assert_equal Mom::SlotConstant , @stats.first.class , @stats
assert_equal Mom::SlotLoad , @stats.first.class , @stats
end
def test_slot_is_set
assert @stats.first.left

View File

@ -21,7 +21,7 @@ module Vool
assert_equal Mom::SlotDefinition , @first.condition.condition.class , @stats
end
def test_hoisetd
assert_equal Mom::SlotMove , @first.hoisted.class
assert_equal Mom::SlotLoad , @first.hoisted.class
end
end
end

View File

@ -27,7 +27,7 @@ module Vool
assert_nil @first.hoisted , @stats
end
def test_array
check_array [Label,SlotMove,TruthCheck,Label] , @stats
check_array [Label,SlotLoad,TruthCheck,Label] , @stats
end
end
end