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