This commit is contained in:
Torsten Ruger 2017-09-04 21:32:01 +03:00
parent 1a219a7c89
commit 65ba867aa9
2 changed files with 23 additions and 20 deletions

View File

@ -7,28 +7,29 @@ module Vool
def setup def setup
Risc.machine.boot Risc.machine.boot
@stats = compile_first_method( "arg = 5") @stats = compile_first_method( "arg = 5")
@first = @stats.first
end end
def test_class_compiles def test_class_compiles
assert_equal Mom::SlotConstant , @stats.first.class , @stats assert_equal Mom::SlotConstant , @first.class , @stats
end end
def test_slot_is_set def test_slot_is_set
assert @stats.first.left assert @first.left
end end
def test_slot_starts_at_message def test_slot_starts_at_message
assert_equal :message , @stats.first.left[0] assert_equal :message , @first.left.known_object
end end
def test_slot_gets_self def test_slot_gets_self
assert_equal :arguments , @stats.first.left[1] assert_equal :arguments , @first.left.slots[0]
end end
def test_slot_assigns_to_local def test_slot_assigns_to_local
assert_equal :arg , @stats.first.left[-1] assert_equal :arg , @first.left.slots[-1]
end end
def test_slot_assigns_something def test_slot_assigns_something
assert @stats.first.right assert @stats.first.right
end end
def test_slot_assigns_int def test_slot_assigns_int
assert_equal IntegerStatement , @stats.first.right.class assert_equal IntegerStatement , @first.right.class
end end
end end
@ -39,28 +40,29 @@ module Vool
def setup def setup
Risc.machine.boot Risc.machine.boot
@stats = compile_first_method( "arg = 5") @stats = compile_first_method( "arg = 5")
@first = @stats.first
end end
def test_class_compiles def test_class_compiles
assert_equal Mom::SlotConstant , @stats.first.class , @stats assert_equal Mom::SlotConstant , @first.class , @stats
end end
def test_slot_is_set def test_slot_is_set
assert @stats.first.left assert @first.left
end end
def test_slot_starts_at_message def test_slot_starts_at_message
assert_equal :message , @stats.first.left[0] assert_equal :message , @first.left.known_object
end end
def test_slot_gets_self def test_slot_gets_self
assert_equal :arguments , @stats.first.left[1] assert_equal :arguments , @first.left.slots[0]
end end
def test_slot_assigns_to_local def test_slot_assigns_to_local
assert_equal :arg , @stats.first.left[-1] assert_equal :arg , @first.left.slots[-1]
end end
def test_slot_assigns_something def test_slot_assigns_something
assert @stats.first.right assert @first.right
end end
def test_slot_assigns_int def test_slot_assigns_int
assert_equal IntegerStatement , @stats.first.right.class assert_equal IntegerStatement , @first.right.class
end end
end end

View File

@ -7,28 +7,29 @@ module Vool
def setup def setup
Risc.machine.boot Risc.machine.boot
@stats = compile_first_method( "a = 5") @stats = compile_first_method( "a = 5")
@first = @stats.first
end end
def test_class_compiles def test_class_compiles
assert_equal Mom::SlotConstant , @stats.first.class , @stats assert_equal Mom::SlotConstant , @first.class , @stats
end end
def test_slot_is_set def test_slot_is_set
assert @stats.first.left assert @first.left
end end
def test_slot_starts_at_message def test_slot_starts_at_message
assert_equal :message , @stats.first.left[0] assert_equal :message , @first.left.known_object
end end
def test_slot_gets_frame def test_slot_gets_frame
assert_equal :frame , @stats.first.left[1] assert_equal :frame , @first.left.slots[0]
end end
def test_slot_assigns_to_local def test_slot_assigns_to_local
assert_equal :a , @stats.first.left[-1] assert_equal :a , @first.left.slots[-1]
end end
def test_slot_assigns_something def test_slot_assigns_something
assert @stats.first.right assert @first.right
end end
def test_slot_assigns_int def test_slot_assigns_int
assert_equal IntegerStatement , @stats.first.right.class assert_equal IntegerStatement , @first.right.class
end end
end end
end end