Torsten Rüger
d1f8733623
Simple is really the descriptive name for the layer Sure, it is "virtual" but that is not as important as the fact that it is simple (or simplified) Also objct (based really) is better, since orientated implies it is a little like that, but only orientated, not really it. Sol only has objects, nothing else Just cause i was renaming anyway
30 lines
873 B
Ruby
30 lines
873 B
Ruby
require_relative "helper"
|
|
|
|
module Sol
|
|
class TestConditionIfSlotMachine < MiniTest::Test
|
|
include SolCompile
|
|
|
|
def setup
|
|
@compiler = compile_main( "if(5.div4) ; @a = 6 ; else; @a = 5 ; end;return" , "Integer.div4")
|
|
@ins = @compiler.slot_instructions.next
|
|
end
|
|
|
|
def test_condition
|
|
assert_equal TruthCheck , @ins.next(3).class
|
|
end
|
|
def test_condition_is_slot
|
|
assert_equal SlotDefinition , @ins.next(3).condition.class , @ins
|
|
end
|
|
def test_hoisted_call
|
|
assert_equal SimpleCall , @ins.next(2).class
|
|
assert_equal :div4 , @ins.next(2).method.name
|
|
end
|
|
def test_array
|
|
check_array [MessageSetup, ArgumentTransfer, SimpleCall, TruthCheck, Label ,
|
|
SlotLoad, Jump, Label, SlotLoad, Label ,
|
|
SlotLoad, ReturnJump,Label, ReturnSequence, Label] , @ins
|
|
end
|
|
|
|
end
|
|
end
|