diff --git a/Gemfile.lock b/Gemfile.lock index 65e06876..b97e088a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -22,13 +22,13 @@ GEM coderay (1.1.2) docile (1.1.5) drydock (0.6.9) - ffi (1.9.18) - ffi (1.9.18-x64-mingw32) + ffi (1.9.25) + ffi (1.9.25-x64-mingw32) formatador (0.2.5) - guard (2.14.1) + guard (2.14.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) - lumberjack (~> 1.0) + lumberjack (>= 1.0.12, < 2.0) nenv (~> 0.1) notiffany (~> 0.0) pry (>= 0.9.12) @@ -38,13 +38,13 @@ GEM guard-minitest (2.4.6) guard-compat (~> 1.2) minitest (>= 3.0) - highline (1.7.8) + highline (2.0.0) json (2.1.0) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - lumberjack (1.0.12) + lumberjack (1.0.13) method_source (0.9.0) minitest (5.11.3) minitest-color (0.0.2) @@ -60,11 +60,11 @@ GEM shellany (~> 0.0) parser (2.3.3.1) ast (~> 2.2) - pry (0.11.1) + pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) - rake (12.1.0) - rb-fsevent (0.10.2) + rake (12.3.1) + rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) rb-readline (0.5.5) diff --git a/test/risc/interpreter/blocks/test_if.rb b/test/risc/interpreter/blocks/test_if.rb new file mode 100644 index 00000000..17a350a7 --- /dev/null +++ b/test/risc/interpreter/blocks/test_if.rb @@ -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 diff --git a/test/risc/interpreter/blocks/test_while.rb b/test/risc/interpreter/blocks/test_while.rb new file mode 100644 index 00000000..81bd7b2d --- /dev/null +++ b/test/risc/interpreter/blocks/test_while.rb @@ -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