Lots of preloading for tests

so many relied (implicitly( on some builtin function
after all can't do much in ruby without calling
Now all those dependencies are explicit
Small risc changes come because the macro version has a return label and unreachable label
This commit is contained in:
2019-09-13 14:07:12 +03:00
parent c9d7539479
commit 12b29285d7
52 changed files with 201 additions and 164 deletions

View File

@ -4,6 +4,7 @@ module Risc
class BlockCallSimple < MiniTest::Test
include Ticker
def setup
@preload = "Integer.div4"
@string_input = block_main("a = yielder {return 16.div4} ; return a")
super
end

View File

@ -1,7 +1,7 @@
require_relative "../helper"
module Risc
class BlockCallSimpleWithArg# < MiniTest::Test
class BlockCallSimpleWithArg < MiniTest::Test
include Ticker
def setup
@string_input = block_main("a = tenner {|b| return b} ; return a" , tenner)
@ -15,6 +15,7 @@ module Risc
class BlockCallArgOp < MiniTest::Test
include Ticker
def setup
@preload = "Integer.mul"
@string_input = block_main("a = tenner {|b| return 2 * b} ; return a" , tenner)
super
end

View File

@ -4,6 +4,7 @@ module Risc
class BlockCallDyn < MiniTest::Test
include Ticker
def setup
@preload = "Integer.div4"
@string_input = block_main("a = tenner {|b| return b.div4} ; return a" , tenner)
super
end
@ -16,6 +17,7 @@ module Risc
class BlockCallArgOpDyn < MiniTest::Test
include Ticker
def setup
@preload = "Integer.mul"
@string_input = block_main("a = tenner {|b| return b*b} ; return a" , tenner)
super
end

View File

@ -4,6 +4,7 @@ module Risc
module BlockIfOp
include Ticker
def setup
@preload = "Integer.gt;Integer.lt"
@string_input = block_main("a = tenner {|b| if( b #{op} 5 ); return 1;else;return 2;end } ; return a" , tenner)
super
end

View File

@ -4,6 +4,7 @@ module Risc
class BlockWhile < MiniTest::Test
include Ticker
def setup
@preload = "Integer.gt;Integer.minus"
@string_input = block_main("a = tenner {|b| #{while_str} } ; return a" , tenner)
super
end