From 55b5884c4e2e9d8852e39373fe82a036ad7daf59 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 2 Jul 2018 23:03:33 +0300 Subject: [PATCH] minor test fixes --- test/risc/interpreter/test_events.rb | 22 ++++++---------------- test/rubyx/test_rubyx_compiler1.rb | 2 +- test/support/risc_interpreter.rb | 3 ++- 3 files changed, 9 insertions(+), 18 deletions(-) diff --git a/test/risc/interpreter/test_events.rb b/test/risc/interpreter/test_events.rb index 0e5250d6..ea2aab2e 100644 --- a/test/risc/interpreter/test_events.rb +++ b/test/risc/interpreter/test_events.rb @@ -5,7 +5,7 @@ module Risc include Ticker def setup - @string_input = as_main("return 5 + 7") + @string_input = as_main("return 5") @state_events = {} @instruction_events = [] super @@ -19,7 +19,7 @@ module Risc @instruction_events << was end def length - 94 + 40 end def test_state_change @interpreter.register_event :state_changed , self @@ -44,22 +44,12 @@ module Risc SlotToReg, SlotToReg, RegToSlot, SlotToReg, Branch, SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot, LoadConstant, RegToSlot, - FunctionCall, LoadConstant, LoadConstant, SlotToReg, RegToSlot, - 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, + FunctionCall, LoadConstant, RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg, FunctionReturn, - SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, - RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg, - SlotToReg, SlotToReg, Branch, FunctionReturn, Transfer, - SlotToReg, Branch, SlotToReg, Syscall, NilClass] + Transfer, SlotToReg, Branch, SlotToReg, Syscall, + NilClass] assert_equal Fixnum , get_return.class - assert_equal 12 , get_return + assert_equal 5 , get_return end def test_length run_all diff --git a/test/rubyx/test_rubyx_compiler1.rb b/test/rubyx/test_rubyx_compiler1.rb index ad5b1a5d..ee2e7e11 100644 --- a/test/rubyx/test_rubyx_compiler1.rb +++ b/test/rubyx/test_rubyx_compiler1.rb @@ -14,7 +14,7 @@ module RubyX def test_creates_class_deriviation mom = ruby_to_mom "class Testing ; end" - #assert mom , "No classes created" + assert mom , "No classes created" end def test_creates_class_with_deriviation diff --git a/test/support/risc_interpreter.rb b/test/support/risc_interpreter.rb index 96ba413e..6a192603 100644 --- a/test/support/risc_interpreter.rb +++ b/test/support/risc_interpreter.rb @@ -9,6 +9,7 @@ module Risc def setup @linker = RubyX::RubyXCompiler.new(@string_input).ruby_to_binary( :interpreter) @interpreter = Interpreter.new(@linker) + @interpreter.start_program end alias :do_setup :setup @@ -57,7 +58,7 @@ module Risc classes = [] tick = 1 begin - while true and (classes.length < max) + while(classes.length < max) cl = ticks(1).class tick += 1 classes << cl