2015-11-07 17:39:17 +02:00
|
|
|
require_relative 'helper'
|
|
|
|
|
2015-11-07 19:38:52 +02:00
|
|
|
class TestLayoutRT < MiniTest::Test
|
2015-11-18 13:04:57 +02:00
|
|
|
include ParfaitTests
|
2015-11-07 17:39:17 +02:00
|
|
|
|
|
|
|
def test_main
|
2015-11-18 13:04:57 +02:00
|
|
|
@main = "return 1"
|
2015-11-20 14:37:26 +02:00
|
|
|
check 1
|
2015-11-07 17:39:17 +02:00
|
|
|
end
|
|
|
|
|
2015-11-20 13:26:35 +02:00
|
|
|
def check_return_class val
|
|
|
|
end
|
|
|
|
|
2015-11-07 17:39:17 +02:00
|
|
|
def test_get_layout
|
2015-11-18 13:04:57 +02:00
|
|
|
@main = "return get_layout()"
|
2015-11-20 14:37:26 +02:00
|
|
|
interpreter = check
|
|
|
|
assert_equal Parfait::Layout , interpreter.get_register(:r0).return_value.class
|
2015-11-07 17:39:17 +02:00
|
|
|
end
|
|
|
|
|
2015-11-07 19:38:52 +02:00
|
|
|
def test_get_class
|
2015-11-18 13:04:57 +02:00
|
|
|
@main = "return get_class()"
|
2015-11-20 14:37:26 +02:00
|
|
|
interpreter = check
|
|
|
|
assert_equal Parfait::Class , interpreter.get_register(:r0).return_value.class
|
2015-11-07 19:38:52 +02:00
|
|
|
end
|
|
|
|
|
2015-11-08 00:55:37 +02:00
|
|
|
def test_puts_class
|
2015-11-18 13:04:57 +02:00
|
|
|
@main = <<HERE
|
2015-11-30 16:10:08 +02:00
|
|
|
Word w = get_class_name()
|
2015-11-08 00:55:37 +02:00
|
|
|
w.putstring()
|
|
|
|
HERE
|
|
|
|
@stdout = "Space"
|
|
|
|
check
|
|
|
|
end
|
2015-11-07 17:39:17 +02:00
|
|
|
|
2015-11-30 16:10:08 +02:00
|
|
|
def test_puts_layout_space
|
|
|
|
@main = <<HERE
|
|
|
|
Layout l = get_layout()
|
|
|
|
Word w = l.get_class_name()
|
|
|
|
w.putstring()
|
|
|
|
HERE
|
|
|
|
@stdout = "Layout"
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
|
|
|
# copy of register parfait tests, in order
|
|
|
|
def test_message_layout
|
|
|
|
@main = <<HERE
|
|
|
|
Message m = self.first_message
|
|
|
|
m = m.next_message
|
|
|
|
Word w = m.get_class_name()
|
|
|
|
w.putstring()
|
|
|
|
HERE
|
|
|
|
@stdout = "Message"
|
|
|
|
check
|
|
|
|
end
|
|
|
|
|
2015-11-07 17:39:17 +02:00
|
|
|
|
|
|
|
end
|