more block tests working
dynamic calls and operators on block args (giant strides)
This commit is contained in:
26
test/risc/interpreter/blocks/test_call_simple_args.rb
Normal file
26
test/risc/interpreter/blocks/test_call_simple_args.rb
Normal file
@ -0,0 +1,26 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class BlockCallSimpleWithArg < MiniTest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
@string_input = block_main("a = tenner {|b| return b} ; return a" , tenner)
|
||||
super
|
||||
end
|
||||
def test_chain
|
||||
run_all
|
||||
assert_equal 10 , get_return
|
||||
end
|
||||
end
|
||||
class BlockCallArgOp < MiniTest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
@string_input = block_main("a = tenner {|b| return 2 * b} ; return a" , tenner)
|
||||
super
|
||||
end
|
||||
def test_chain
|
||||
run_all
|
||||
assert_equal 20 , get_return
|
||||
end
|
||||
end
|
||||
end
|
27
test/risc/interpreter/blocks/test_dyn_call.rb
Normal file
27
test/risc/interpreter/blocks/test_dyn_call.rb
Normal file
@ -0,0 +1,27 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
class BlockCallDyn < MiniTest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
@string_input = block_main("a = tenner {|b| return b.div4} ; return a" , tenner)
|
||||
super
|
||||
end
|
||||
def test_chain
|
||||
#show_main_ticks # get output of what is
|
||||
run_all
|
||||
assert_equal 2 , get_return , "10.div4"
|
||||
end
|
||||
end
|
||||
class BlockCallArgOpDyn < MiniTest::Test
|
||||
include Ticker
|
||||
def setup
|
||||
@string_input = block_main("a = tenner {|b| return b*b} ; return a" , tenner)
|
||||
super
|
||||
end
|
||||
def test_chain
|
||||
run_all
|
||||
assert_equal 100 , get_return , "10*10"
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user