2018-04-19 18:59:48 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
2019-08-11 13:31:00 +02:00
|
|
|
# TODO move these to interpreter dir
|
2018-04-19 18:59:48 +02:00
|
|
|
module Risc
|
|
|
|
module Builtin
|
2018-04-24 18:45:58 +02:00
|
|
|
class IntCmp < BuiltinTest
|
2018-04-19 18:59:48 +02:00
|
|
|
|
2018-04-19 21:57:31 +02:00
|
|
|
def test_smaller_true
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "4 < 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-19 21:13:52 +02:00
|
|
|
end
|
2018-04-19 21:57:31 +02:00
|
|
|
def test_smaller_false
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "6 < 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-19 21:57:31 +02:00
|
|
|
end
|
2018-04-23 18:39:16 +02:00
|
|
|
def test_smaller_false_same
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 < 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-23 18:39:16 +02:00
|
|
|
end
|
2018-04-19 21:57:31 +02:00
|
|
|
def test_larger_true
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 > 4"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-19 21:57:31 +02:00
|
|
|
end
|
|
|
|
def test_larger_false
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 > 6"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-19 21:57:31 +02:00
|
|
|
end
|
2018-04-23 18:39:16 +02:00
|
|
|
def test_larger_false_same
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 > 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-23 18:39:16 +02:00
|
|
|
end
|
2018-04-24 18:45:58 +02:00
|
|
|
|
|
|
|
def test_smaller_or_true
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "4 <= 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
|
|
|
def test_smaller_or_false
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "6 <= 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
|
|
|
def test_smaller_or_same
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 <= 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
|
|
|
def test_larger_or_true
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 >= 4"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
|
|
|
def test_larger_or_false
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 >= 6"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
|
|
|
def test_larger_or_same
|
2018-05-25 19:40:39 +02:00
|
|
|
run_main_return "5 >= 5"
|
2018-06-19 17:55:47 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_message_return.class
|
2018-04-24 18:45:58 +02:00
|
|
|
end
|
2018-04-19 18:59:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|