fixing tests for shifting constants into slots

This commit is contained in:
Torsten Ruger
2018-03-17 21:15:38 +05:30
parent 3fecdf54a5
commit cddc25a595
10 changed files with 14 additions and 13 deletions

View File

@ -15,7 +15,7 @@ module Risc
def test_constant_load
produced = produce_body
assert_equal 5 , produced.constant.value
assert_equal 5 , produced.constant.known_object.value
end
def test_slot_move

View File

@ -18,8 +18,8 @@ module Vool
end
def test_receiver
type , value = receiver
assert_equal type, @ins.next.right.class
assert_equal value, @ins.next.right.value
assert_equal type, @ins.next.right.known_object.class
assert_equal value, @ins.next.right.known_object.value
end
def test_call_is
assert_equal Mom::SimpleCall, @ins.next(3).class

View File

@ -19,8 +19,8 @@ module Vool
assert_equal :arguments, @ins.next(2).arguments[1].left.slots[1]
end
def test_args_two_str
assert_equal Mom::IntegerConstant, @ins.next(2).arguments[1].right.class
assert_equal 2, @ins.next(2).arguments[1].right.value
assert_equal Mom::IntegerConstant, @ins.next(2).arguments[1].right.known_object.class
assert_equal 2, @ins.next(2).arguments[1].right.known_object.value
end
def test_array
check_array [Mom::MessageSetup,Mom::SlotLoad,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins

View File

@ -19,8 +19,8 @@ module Vool
assert_equal :arguments, @ins.next.next.arguments[0].left.slots[1]
end
def test_args_one_str
assert_equal Mom::IntegerConstant, @ins.next.next.arguments[0].right.class
assert_equal 1, @ins.next.next.arguments[0].right.value
assert_equal Mom::IntegerConstant, @ins.next.next.arguments[0].right.known_object.class
assert_equal 1, @ins.next.next.arguments[0].right.known_object.value
end
def test_array
check_array [Mom::MessageSetup,Mom::SlotLoad,Mom::ArgumentTransfer,Mom::SimpleCall] , @ins

View File

@ -28,7 +28,7 @@ module Vool
assert @stats.right
end
def test_slot_assigns_int
assert_equal Mom::IntegerConstant , @stats.right.class
assert_equal Mom::IntegerConstant , @stats.right.known_object.class
end
end
@ -78,7 +78,7 @@ module Vool
def test_assigns_const
@stats = compile_first_method( "@a = 5")
assert_equal Mom::SlotLoad , @stats.class , @stats
assert_equal Mom::IntegerConstant , @stats.right.class , @stats
assert_equal Mom::IntegerConstant , @stats.right.known_object.class , @stats
end
def test_assigns_move
@stats = compile_first_method( "@a = arg")

View File

@ -31,7 +31,7 @@ module Vool
assert @ins.right
end
def test_slot_assigns_int
assert_equal Mom::IntegerConstant , @ins.right.class
assert_equal Mom::IntegerConstant , @ins.right.known_object.class
end
end
end

View File

@ -31,7 +31,7 @@ module Vool
assert @ins.right
end
def test_slot_assigns_int
assert_equal Mom::IntegerConstant , @ins.right.class
assert_equal Mom::IntegerConstant , @ins.right.known_object.class
end
end
end

View File

@ -32,7 +32,7 @@ module Vool
assert @inst.right
end
def test_slot_assigns_int
assert_equal Mom::IntegerConstant , @inst.right.class
assert_equal Mom::IntegerConstant , @inst.right.known_object.class
end
def test_array
check_array [SlotLoad,ReturnSequence] , @ins