move more tests from interpreter to mains

while now
all interpreter tests with only return tests move now
This commit is contained in:
Torsten 2020-03-27 19:04:10 +02:00
parent b378a42928
commit c29bb44159
8 changed files with 15 additions and 95 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,4 +1,4 @@
require_relative "../helper"
require_relative "helper"
module Risc
class InterpreterAssignLocal < MiniTest::Test

View File

@ -1,4 +1,4 @@
require_relative "../helper"
require_relative "helper"
module Risc
class InterpreterWhileSimple < MiniTest::Test

View File

@ -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

View File

@ -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