Torsten Rüger
fa0aa30386
Since Builtin generates risc, just like mom instructions, it was a design mistake to put builtin into risc in the first place. Now that borders are coming more into focus, it make much more sense to have the builtin in mom. In fact the instructions should be moved out and a seperate invocation mechanism used , so functions can be parsed, not generated (wip)
63 lines
1.8 KiB
Ruby
63 lines
1.8 KiB
Ruby
require_relative "helper"
|
|
|
|
# TODO move these to interpreter dir
|
|
module Mom
|
|
module Builtin
|
|
class IntCmp < BuiltinTest
|
|
include Ticker
|
|
def setup
|
|
end
|
|
|
|
def test_smaller_true
|
|
run_main_return "4 < 5"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
def test_smaller_false
|
|
run_main_return "6 < 5"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
def test_smaller_false_same
|
|
run_main_return "5 < 5"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
def test_larger_true
|
|
run_main_return "5 > 4"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
def test_larger_false
|
|
run_main_return "5 > 6"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
def test_larger_false_same
|
|
run_main_return "5 > 5"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
|
|
def test_smaller_or_true
|
|
run_main_return "4 <= 5"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
def test_smaller_or_false
|
|
run_main_return "6 <= 5"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
def test_smaller_or_same
|
|
run_main_return "5 <= 5"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
def test_larger_or_true
|
|
run_main_return "5 >= 4"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
def test_larger_or_false
|
|
run_main_return "5 >= 6"
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
|
end
|
|
def test_larger_or_same
|
|
run_main_return "5 >= 5"
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
|
end
|
|
end
|
|
end
|
|
end
|