extract the ruby from mains tests

move up in directory
in preparation for arm tests
This commit is contained in:
Torsten Ruger
2018-06-24 11:56:10 +03:00
parent 87be6bf9d5
commit 563ed4647a
8 changed files with 47 additions and 45 deletions

View File

@ -1,5 +0,0 @@
# Method testing
Test Whole methods by their output. Using the main method (implicitly)
Through Interpreter

View File

@ -1,8 +0,0 @@
require_relative '../helper'
module Mains
class MainsTest < MiniTest::Test
include Risc::Ticker
def setup;end
end
end

View File

@ -1,45 +0,0 @@
require_relative 'helper'
module Mains
class TestAdds < MainsTest
def test_ruby_adds
run_main <<HERE
a = 0
b = 20
while( a < b )
a = a + 1
b = b - 1
end
return a
HERE
assert_equal 10 , get_return
end
def test_ruby_subs
run_main <<HERE
b = 10
while( b >= 1 )
b = b - 1
end
return b
HERE
assert_equal 0 , get_return
end
def test_ruby_adds_fibo
run_main <<HERE
n = 6
a = 0
b = 1
i = 1
while( i < n )
result = a + b
a = b
b = result
i = i + 1
end
return result
HERE
assert_equal 8 , get_return
end
end
end

View File

@ -1,13 +0,0 @@
require_relative 'helper'
module Mains
class TestPuts < MainsTest
def test_say_hi
hi = "Hello there"
run_main_return "'#{hi}'.putstring"
assert_equal hi.length , get_return
assert_equal hi , @interpreter.stdout
end
end
end