minor test fixes

This commit is contained in:
Torsten Ruger 2018-07-02 23:03:33 +03:00
parent 56f2742e89
commit 55b5884c4e
3 changed files with 9 additions and 18 deletions

View File

@ -5,7 +5,7 @@ module Risc
include Ticker include Ticker
def setup def setup
@string_input = as_main("return 5 + 7") @string_input = as_main("return 5")
@state_events = {} @state_events = {}
@instruction_events = [] @instruction_events = []
super super
@ -19,7 +19,7 @@ module Risc
@instruction_events << was @instruction_events << was
end end
def length def length
94 40
end end
def test_state_change def test_state_change
@interpreter.register_event :state_changed , self @interpreter.register_event :state_changed , self
@ -44,22 +44,12 @@ module Risc
SlotToReg, SlotToReg, RegToSlot, SlotToReg, Branch, SlotToReg, SlotToReg, RegToSlot, SlotToReg, Branch,
SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg,
RegToSlot, SlotToReg, RegToSlot, LoadConstant, RegToSlot, RegToSlot, SlotToReg, RegToSlot, LoadConstant, RegToSlot,
FunctionCall, LoadConstant, LoadConstant, SlotToReg, RegToSlot, FunctionCall, LoadConstant, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, RegToSlot, Branch,
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, SlotToReg, Branch, FunctionCall,
SlotToReg, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
OperatorInstruction, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
RegToSlot, RegToSlot, SlotToReg, Branch, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, Transfer, SlotToReg, Branch, SlotToReg, Syscall,
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, NilClass]
SlotToReg, SlotToReg, Branch, FunctionReturn, Transfer,
SlotToReg, Branch, SlotToReg, Syscall, NilClass]
assert_equal Fixnum , get_return.class assert_equal Fixnum , get_return.class
assert_equal 12 , get_return assert_equal 5 , get_return
end end
def test_length def test_length
run_all run_all

View File

@ -14,7 +14,7 @@ module RubyX
def test_creates_class_deriviation def test_creates_class_deriviation
mom = ruby_to_mom "class Testing ; end" mom = ruby_to_mom "class Testing ; end"
#assert mom , "No classes created" assert mom , "No classes created"
end end
def test_creates_class_with_deriviation def test_creates_class_with_deriviation

View File

@ -9,6 +9,7 @@ module Risc
def setup def setup
@linker = RubyX::RubyXCompiler.new(@string_input).ruby_to_binary( :interpreter) @linker = RubyX::RubyXCompiler.new(@string_input).ruby_to_binary( :interpreter)
@interpreter = Interpreter.new(@linker) @interpreter = Interpreter.new(@linker)
@interpreter.start_program
end end
alias :do_setup :setup alias :do_setup :setup
@ -57,7 +58,7 @@ module Risc
classes = [] classes = []
tick = 1 tick = 1
begin begin
while true and (classes.length < max) while(classes.length < max)
cl = ticks(1).class cl = ticks(1).class
tick += 1 tick += 1
classes << cl classes << cl