2019-08-12 12:16:15 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
|
|
|
module Builtin
|
2019-09-13 09:41:13 +02:00
|
|
|
class TestIntOpPl < BootTest
|
2019-08-12 12:16:15 +02:00
|
|
|
def setup
|
2019-09-13 09:41:13 +02:00
|
|
|
@method = get_compiler("Integer",:and)
|
2019-08-12 12:16:15 +02:00
|
|
|
end
|
2019-09-13 09:41:13 +02:00
|
|
|
def test_mom_length
|
|
|
|
assert_equal :& , @method.callable.name
|
|
|
|
assert_equal 7 , @method.mom_instructions.length
|
2019-08-12 12:16:15 +02:00
|
|
|
end
|
|
|
|
def test_compile
|
2019-09-13 09:41:13 +02:00
|
|
|
assert_equal Risc::MethodCompiler , @method.to_risc.class
|
2019-08-12 12:16:15 +02:00
|
|
|
end
|
|
|
|
def test_risc_length
|
2019-09-13 09:41:13 +02:00
|
|
|
assert_equal 42 , @method.to_risc.risc_instructions.length
|
|
|
|
end
|
|
|
|
end
|
|
|
|
class TestIntOpMM < BootTest
|
|
|
|
def setup
|
|
|
|
@method = get_compiler("Integer",:or)
|
|
|
|
end
|
|
|
|
def test_mom_length
|
|
|
|
assert_equal :| , @method.callable.name
|
|
|
|
assert_equal 7 , @method.mom_instructions.length
|
|
|
|
end
|
|
|
|
def test_compile
|
|
|
|
assert_equal Risc::MethodCompiler , @method.to_risc.class
|
|
|
|
end
|
|
|
|
def test_risc_length
|
|
|
|
assert_equal 42 , @method.to_risc.risc_instructions.length
|
2019-08-12 12:16:15 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|