2019-08-12 12:16:15 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
|
|
|
module Builtin
|
|
|
|
class TestIntOperatorsRisc < BootTest
|
|
|
|
def setup
|
|
|
|
super
|
|
|
|
end
|
|
|
|
def each_method &block
|
|
|
|
Risc.operators.each do |name|
|
2019-08-22 16:52:19 +02:00
|
|
|
method = get_operator_compiler(name)
|
2019-08-12 12:16:15 +02:00
|
|
|
block.yield(method)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def test_compile
|
|
|
|
each_method do |method|
|
|
|
|
assert_equal Risc::MethodCompiler , method.to_risc.class
|
|
|
|
end
|
|
|
|
end
|
|
|
|
def test_risc_length
|
|
|
|
each_method do |method|
|
2019-08-22 16:52:19 +02:00
|
|
|
assert_equal 48 , method.to_risc.risc_instructions.length
|
2019-08-12 12:16:15 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|