From c29bb44159fed061d6f8093196c4ae4378fb1342 Mon Sep 17 00:00:00 2001 From: Torsten Date: Fri, 27 Mar 2020 19:04:10 +0200 Subject: [PATCH] move more tests from interpreter to mains while now all interpreter tests with only return tests move now --- test/mains/test_while.rb | 14 +++++++++++++- .../interpreter/assign/test_assign_return.rb | 18 ------------------ .../interpreter/assign/test_assign_thrice.rb | 19 ------------------- .../interpreter/assign/test_assign_twice.rb | 18 ------------------ .../{assign => }/test_assign_local.rb | 2 +- .../{while => }/test_while_simple.rb | 2 +- test/risc/interpreter/while/test_while_cmp.rb | 18 ------------------ .../interpreter/while/test_while_count.rb | 19 ------------------- 8 files changed, 15 insertions(+), 95 deletions(-) delete mode 100644 test/risc/interpreter/assign/test_assign_return.rb delete mode 100644 test/risc/interpreter/assign/test_assign_thrice.rb delete mode 100644 test/risc/interpreter/assign/test_assign_twice.rb rename test/risc/interpreter/{assign => }/test_assign_local.rb (97%) rename test/risc/interpreter/{while => }/test_while_simple.rb (98%) delete mode 100644 test/risc/interpreter/while/test_while_cmp.rb delete mode 100644 test/risc/interpreter/while/test_while_count.rb diff --git a/test/mains/test_while.rb b/test/mains/test_while.rb index c63ff571..fc6d877f 100644 --- a/test/mains/test_while.rb +++ b/test/mains/test_while.rb @@ -4,10 +4,22 @@ module Mains class WhileTester < MiniTest::Test include MainsHelper - def test_while + def test_while_cmp @preload = "Integer.gt;Integer.plus" @input = as_main 'a = -1; while( 0 > a); a = 1 + a;end;return a' assert_result 0 , "" end + + def test_while_count + @preload = "Integer.gt;Integer.plus" + @input = as_main 'a = -1; while( 0 > a); a = 1 + a;end;return a' + assert_result 0 , "" + end + + def test_while_simple + @input = as_main 'a = true; while( a ); a = false;end;return a' +# assert_result 4 , "" + end + end end diff --git a/test/risc/interpreter/assign/test_assign_return.rb b/test/risc/interpreter/assign/test_assign_return.rb deleted file mode 100644 index 758b7519..00000000 --- a/test/risc/interpreter/assign/test_assign_return.rb +++ /dev/null @@ -1,18 +0,0 @@ -require_relative "../helper" - -module Risc - class InterpreterAssignReturn < MiniTest::Test - include Ticker - - def setup - @preload = "Integer.plus" - @string_input = as_main("a = 5 + 5 ; return a") - super - end - - def test_ret - run_all - assert_equal 10 , get_return - end - end -end diff --git a/test/risc/interpreter/assign/test_assign_thrice.rb b/test/risc/interpreter/assign/test_assign_thrice.rb deleted file mode 100644 index 8be9aa13..00000000 --- a/test/risc/interpreter/assign/test_assign_thrice.rb +++ /dev/null @@ -1,19 +0,0 @@ -require_relative "../helper" - -module Risc - class InterpreterAssignThrice < MiniTest::Test - include Ticker - - def setup - @preload = "Integer.plus" - @string_input = as_main("a = 5 ;a = 5 + a ;a = 5 + a ; return a") - super - end - - def test_all - run_all - assert_equal 15 , get_return - end - - end -end diff --git a/test/risc/interpreter/assign/test_assign_twice.rb b/test/risc/interpreter/assign/test_assign_twice.rb deleted file mode 100644 index c1ca0377..00000000 --- a/test/risc/interpreter/assign/test_assign_twice.rb +++ /dev/null @@ -1,18 +0,0 @@ -require_relative "../helper" - -module Risc - class InterpreterAssignTwice < MiniTest::Test - include Ticker - - def setup - @preload = "Integer.plus" - @string_input = as_main("a = 5 ;a = 5 + a ; return a") - super - end - - def test_ret - run_all - assert_equal 10 , get_return - end - end -end diff --git a/test/risc/interpreter/assign/test_assign_local.rb b/test/risc/interpreter/test_assign_local.rb similarity index 97% rename from test/risc/interpreter/assign/test_assign_local.rb rename to test/risc/interpreter/test_assign_local.rb index 4672756b..acc10f25 100644 --- a/test/risc/interpreter/assign/test_assign_local.rb +++ b/test/risc/interpreter/test_assign_local.rb @@ -1,4 +1,4 @@ -require_relative "../helper" +require_relative "helper" module Risc class InterpreterAssignLocal < MiniTest::Test diff --git a/test/risc/interpreter/while/test_while_simple.rb b/test/risc/interpreter/test_while_simple.rb similarity index 98% rename from test/risc/interpreter/while/test_while_simple.rb rename to test/risc/interpreter/test_while_simple.rb index b1746bed..6056d082 100644 --- a/test/risc/interpreter/while/test_while_simple.rb +++ b/test/risc/interpreter/test_while_simple.rb @@ -1,4 +1,4 @@ -require_relative "../helper" +require_relative "helper" module Risc class InterpreterWhileSimple < MiniTest::Test diff --git a/test/risc/interpreter/while/test_while_cmp.rb b/test/risc/interpreter/while/test_while_cmp.rb deleted file mode 100644 index 3968295f..00000000 --- a/test/risc/interpreter/while/test_while_cmp.rb +++ /dev/null @@ -1,18 +0,0 @@ -require_relative "../helper" - -module Risc - class InterpreterWhileCmp < MiniTest::Test - include Ticker - - def setup - @preload = "Integer.ge;Integer.plus" - @string_input = as_main 'a = 0; while( 0 >= a); a = 1 + a;end;return a' - super - end - - def test_while - run_all - assert_equal 1 , get_return - end - end -end diff --git a/test/risc/interpreter/while/test_while_count.rb b/test/risc/interpreter/while/test_while_count.rb deleted file mode 100644 index 4a74812a..00000000 --- a/test/risc/interpreter/while/test_while_count.rb +++ /dev/null @@ -1,19 +0,0 @@ -require_relative "../helper" - -module Risc - class InterpreterWhileCount < MiniTest::Test - include Ticker - include Preloader - - def setup - @preload = "Integer.gt;Integer.plus" - @string_input = as_main 'a = -1; while( 0 > a); a = 1 + a;end;return a' - super - end - - def test_while - run_all - assert_equal 0 , get_return - end - end -end