block tests for if and while
bundle update too
This commit is contained in:
parent
4f3c0d8b08
commit
050659ea12
18
Gemfile.lock
18
Gemfile.lock
@ -22,13 +22,13 @@ GEM
|
|||||||
coderay (1.1.2)
|
coderay (1.1.2)
|
||||||
docile (1.1.5)
|
docile (1.1.5)
|
||||||
drydock (0.6.9)
|
drydock (0.6.9)
|
||||||
ffi (1.9.18)
|
ffi (1.9.25)
|
||||||
ffi (1.9.18-x64-mingw32)
|
ffi (1.9.25-x64-mingw32)
|
||||||
formatador (0.2.5)
|
formatador (0.2.5)
|
||||||
guard (2.14.1)
|
guard (2.14.2)
|
||||||
formatador (>= 0.2.4)
|
formatador (>= 0.2.4)
|
||||||
listen (>= 2.7, < 4.0)
|
listen (>= 2.7, < 4.0)
|
||||||
lumberjack (~> 1.0)
|
lumberjack (>= 1.0.12, < 2.0)
|
||||||
nenv (~> 0.1)
|
nenv (~> 0.1)
|
||||||
notiffany (~> 0.0)
|
notiffany (~> 0.0)
|
||||||
pry (>= 0.9.12)
|
pry (>= 0.9.12)
|
||||||
@ -38,13 +38,13 @@ GEM
|
|||||||
guard-minitest (2.4.6)
|
guard-minitest (2.4.6)
|
||||||
guard-compat (~> 1.2)
|
guard-compat (~> 1.2)
|
||||||
minitest (>= 3.0)
|
minitest (>= 3.0)
|
||||||
highline (1.7.8)
|
highline (2.0.0)
|
||||||
json (2.1.0)
|
json (2.1.0)
|
||||||
listen (3.1.5)
|
listen (3.1.5)
|
||||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||||
rb-inotify (~> 0.9, >= 0.9.7)
|
rb-inotify (~> 0.9, >= 0.9.7)
|
||||||
ruby_dep (~> 1.2)
|
ruby_dep (~> 1.2)
|
||||||
lumberjack (1.0.12)
|
lumberjack (1.0.13)
|
||||||
method_source (0.9.0)
|
method_source (0.9.0)
|
||||||
minitest (5.11.3)
|
minitest (5.11.3)
|
||||||
minitest-color (0.0.2)
|
minitest-color (0.0.2)
|
||||||
@ -60,11 +60,11 @@ GEM
|
|||||||
shellany (~> 0.0)
|
shellany (~> 0.0)
|
||||||
parser (2.3.3.1)
|
parser (2.3.3.1)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pry (0.11.1)
|
pry (0.11.3)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.9.0)
|
method_source (~> 0.9.0)
|
||||||
rake (12.1.0)
|
rake (12.3.1)
|
||||||
rb-fsevent (0.10.2)
|
rb-fsevent (0.10.3)
|
||||||
rb-inotify (0.9.10)
|
rb-inotify (0.9.10)
|
||||||
ffi (>= 0.5.0, < 2)
|
ffi (>= 0.5.0, < 2)
|
||||||
rb-readline (0.5.5)
|
rb-readline (0.5.5)
|
||||||
|
34
test/risc/interpreter/blocks/test_if.rb
Normal file
34
test/risc/interpreter/blocks/test_if.rb
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
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
|
19
test/risc/interpreter/blocks/test_while.rb
Normal file
19
test/risc/interpreter/blocks/test_while.rb
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
require_relative "../helper"
|
||||||
|
|
||||||
|
module Risc
|
||||||
|
class BlockWhile < MiniTest::Test
|
||||||
|
include Ticker
|
||||||
|
def setup
|
||||||
|
@string_input = block_main("a = tenner {|b| #{while_str} } ; return a" , tenner)
|
||||||
|
super
|
||||||
|
end
|
||||||
|
def while_str
|
||||||
|
"while( b > 5); b = b - 1 ;end;return b"
|
||||||
|
end
|
||||||
|
def test_chain
|
||||||
|
#show_main_ticks # get output of what is
|
||||||
|
run_all
|
||||||
|
assert_equal 5 , get_return , while_str
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user