2018-03-19 11:58:53 +01:00
|
|
|
require_relative '../helper'
|
2018-03-17 06:43:44 +01:00
|
|
|
|
|
|
|
module Risc
|
2018-04-19 18:23:12 +02:00
|
|
|
class TestAssignLocalFalse < MiniTest::Test
|
2018-03-17 06:43:44 +01:00
|
|
|
include Statements
|
|
|
|
|
|
|
|
def setup
|
2019-08-17 22:29:42 +02:00
|
|
|
@input = "r = false;return"
|
2019-08-23 09:21:22 +02:00
|
|
|
@expect = [LoadConstant, RegToSlot,LoadConstant, RegToSlot, Branch]
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
def test_local_assign_instructions
|
|
|
|
assert_nil msg = check_nil , msg
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_constant_load
|
|
|
|
produced = produce_body
|
2018-04-19 18:23:12 +02:00
|
|
|
assert_equal Parfait::FalseClass , produced.constant.class
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
|
2018-03-24 14:59:54 +01:00
|
|
|
def test_frame_load
|
|
|
|
produced = produce_body
|
2018-07-15 14:16:12 +02:00
|
|
|
assert_equal :Message , produced.next(1).array.type.class_name
|
2019-08-23 09:21:22 +02:00
|
|
|
assert_equal 16 , produced.next(1).index # 3 is frame
|
2018-03-24 14:59:54 +01:00
|
|
|
end
|
|
|
|
def test_value_load
|
2018-03-17 06:43:44 +01:00
|
|
|
produced = produce_body
|
2018-03-19 11:17:40 +01:00
|
|
|
assert_equal produced.next(2).register , produced.register
|
2019-08-23 09:21:22 +02:00
|
|
|
assert_equal 16 , produced.next(1).index #type == 0 , r == 16
|
2018-03-17 06:43:44 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|