From 599679d6e83ce52cf954518596c8cbe374c9bc3f Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sun, 1 Apr 2018 22:42:27 +0300 Subject: [PATCH] simplest if without true/false or logic --- test/risc/interpreter/test_simple_if10.rb | 31 +++++++++++++++ test/risc/interpreter/wip/test_simple_if.rb | 42 --------------------- 2 files changed, 31 insertions(+), 42 deletions(-) create mode 100644 test/risc/interpreter/test_simple_if10.rb delete mode 100644 test/risc/interpreter/wip/test_simple_if.rb diff --git a/test/risc/interpreter/test_simple_if10.rb b/test/risc/interpreter/test_simple_if10.rb new file mode 100644 index 00000000..f4c2f648 --- /dev/null +++ b/test/risc/interpreter/test_simple_if10.rb @@ -0,0 +1,31 @@ +require_relative "helper" + +module Risc + class InterreterSimpleIf10 < MiniTest::Test + include Ticker + + def setup + @string_input = as_main 'if( 10 ); return "then";else;return "else";end' + super + end + + def test_if + #show_ticks # get output of what is + check_chain [Branch, Label, LoadConstant, SlotToReg, LoadConstant, + SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg, + SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant, + SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot, + SlotToReg, RegToSlot, LoadConstant, RegToSlot, FunctionCall, + Label, LoadConstant, LoadConstant, OperatorInstruction, IsNotZero, + Label, LoadConstant, RegToSlot, SlotToReg, SlotToReg, + RegToSlot, SlotToReg, SlotToReg, FunctionReturn, Transfer, + Syscall, NilClass] + assert_equal Parfait::Word , get_return.class + assert_equal "else" , get_return.to_string + end + def test_exit + done = ticks(41) + assert_equal Syscall , done.class + end + end +end diff --git a/test/risc/interpreter/wip/test_simple_if.rb b/test/risc/interpreter/wip/test_simple_if.rb deleted file mode 100644 index d7aaab67..00000000 --- a/test/risc/interpreter/wip/test_simple_if.rb +++ /dev/null @@ -1,42 +0,0 @@ -require_relative "../helper" - -module Risc - class IfSimpleTest < MiniTest::Test - include Ticker - include CleanCompile - - def setup - @string_input = <