adds a mom version of basic values

This commit is contained in:
Torsten Ruger
2018-03-13 12:30:51 +05:30
parent 45bfe118d1
commit b297650b78
20 changed files with 94 additions and 30 deletions

View File

@ -16,7 +16,7 @@ module Mom
assert_equal 1 , @stats.length
end
def test_assigns_class
assert_equal Vool::IntegerStatement , @stats.right.class , @stats.inspect
assert_equal Mom::IntegerConstant , @stats.right.class , @stats.inspect
end
def test_assigns_value
assert_equal 5 , @stats.right.value , @stats.inspect
@ -49,7 +49,7 @@ module Mom
assert_equal 1 , @stats.length
end
def test_assigns_class
assert_equal Vool::InstanceVariable , @stats.right.class , @stats.inspect
assert_equal Mom::SlotDefinition , @stats.right.class , @stats.inspect
end
end
end

View File

@ -13,8 +13,8 @@ module Mom
def test_if_compiles
assert_equal @stats.last.class , SimpleCall , @stats
end
def test_length
assert_equal 3 , @stats.length
def test_method_name
assert_equal @stats.last.method.name , :mod4 , @stats.last.to_rxf
end
def test_array
check_array [MessageSetup,ArgumentTransfer,SimpleCall] , @stats

View File

@ -16,7 +16,7 @@ module Vool
end
def test_receiver
assert_equal SelfStatement, @stats[1].receiver.right.class
assert_equal Mom::SlotDefinition, @stats[1].receiver.right.class
end
def test_arg_one

View File

@ -12,7 +12,7 @@ module Vool
@first = @stats.first
end
def receiver
[IntegerStatement , 5]
[Mom::IntegerConstant , 5]
end
def test_call_has_right_method
assert_equal :mod4, @stats[2].method.name

View File

@ -12,14 +12,14 @@ module Vool
end
def receiver
[IntegerStatement , 5]
[Mom::IntegerConstant , 5]
end
def test_args_two_move
assert_equal :next_message, @stats[1].arguments[1].left.slots[0]
assert_equal :arguments, @stats[1].arguments[1].left.slots[1]
end
def test_args_two_str
assert_equal IntegerStatement, @stats[1].arguments[1].right.class
assert_equal Mom::IntegerConstant, @stats[1].arguments[1].right.class
assert_equal 2, @stats[1].arguments[1].right.value
end
end

View File

@ -12,7 +12,7 @@ module Vool
@first = @stats.first
end
def receiver
[StringStatement , "5"]
[Mom::StringConstant , "5"]
end
def test_args_one_move
@ -20,7 +20,7 @@ module Vool
assert_equal :arguments, @stats[1].arguments[0].left.slots[1]
end
def test_args_one_str
assert_equal IntegerStatement, @stats[1].arguments[0].right.class
assert_equal Mom::IntegerConstant, @stats[1].arguments[0].right.class
assert_equal 1, @stats[1].arguments[0].right.value
end
end

View File

@ -29,7 +29,7 @@ module Vool
assert @stats.first.right
end
def test_slot_assigns_int
assert_equal IntegerStatement , @first.right.class
assert_equal Mom::IntegerConstant , @first.right.class
end
end

View File

@ -31,7 +31,7 @@ module Vool
assert @method.first.right
end
def test_slot_assigns_int
assert_equal IntegerStatement , @method.first.right.class
assert_equal Mom::IntegerConstant , @method.first.right.class
end
end
end

View File

@ -32,7 +32,7 @@ module Vool
assert @first.right
end
def test_slot_assigns_int
assert_equal IntegerStatement , @first.right.class
assert_equal Mom::IntegerConstant , @first.right.class
end
end
end

View File

@ -34,7 +34,7 @@ module Vool
assert @stats.first.right
end
def test_slot_assigns_int
assert_equal IntegerStatement , @stats.first.right.class
assert_equal Mom::IntegerConstant , @stats.first.right.class
end
end
class TestReturnSendMom < MiniTest::Test
@ -42,7 +42,7 @@ module Vool
def setup
Risc.machine.boot
@stats = compile_first_method( "return foo").first
@stats = compile_first_method( "return 5.mod4").first
end
def test_two_instructions_are_returned