2018-04-19 18:59:48 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
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-04-24 19:12:49 +02:00
|
|
|
run_main "4 < 5"
|
2018-04-19 21:41:40 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
2018-04-19 21:13:52 +02:00
|
|
|
end
|
2018-04-19 21:57:31 +02:00
|
|
|
def test_smaller_false
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "6 < 5"
|
2018-04-19 21:57:31 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
2018-04-23 18:39:16 +02:00
|
|
|
def test_smaller_false_same
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 < 5"
|
2018-04-23 18:39:16 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
2018-04-19 21:57:31 +02:00
|
|
|
def test_larger_true
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 > 4"
|
2018-04-19 21:57:31 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_larger_false
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 > 6"
|
2018-04-19 21:57:31 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
2018-04-23 18:39:16 +02:00
|
|
|
def test_larger_false_same
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 > 5"
|
2018-04-23 18:39:16 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
2018-04-24 18:45:58 +02:00
|
|
|
|
|
|
|
def test_smaller_or_true
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "4 <= 5"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_smaller_or_false
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "6 <= 5"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_smaller_or_same
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 <= 5"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_larger_or_true
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 >= 4"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_larger_or_false
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 >= 6"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::FalseClass , get_return.class
|
|
|
|
end
|
|
|
|
def test_larger_or_same
|
2018-04-24 19:12:49 +02:00
|
|
|
run_main "5 >= 5"
|
2018-04-24 18:45:58 +02:00
|
|
|
assert_equal Parfait::TrueClass , get_return.class
|
|
|
|
end
|
2018-04-19 18:59:48 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|