rubyx/test/risc/interpreter/blocks/test_if.rb
Torsten Ruger 050659ea12 block tests for if and while
bundle update too
2018-08-01 20:17:41 +03:00

35 lines
627 B
Ruby

require_relative "../helper"
module Risc
module BlockIfOp
include Ticker
def setup
@string_input = block_main("a = tenner {|b| if( b #{op} 5 ); return 1;else;return 2;end } ; return a" , tenner)
super
end
def test_chain
#show_main_ticks # get output of what is
run_all
assert_equal res , get_return , "10 #{op} 5"
end
end
class BlockIfSmall < MiniTest::Test
include BlockIfOp
def op
"<"
end
def res
2
end
end
class BlockIfLarge < MiniTest::Test
include BlockIfOp
def op
">"
end
def res
1
end
end
end