bit of renaming and a string test

This commit is contained in:
Torsten Ruger
2018-04-24 20:12:49 +03:00
parent ee28d12429
commit 6fc84d2f98
13 changed files with 61 additions and 271 deletions

View File

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

View File

@ -1,12 +1,12 @@
require_relative '../helper'
module Mains
class TestLargerWhile < MiniTest::Test
class TestAdds < MiniTest::Test
include Risc::Ticker
def setup;end
def test_ruby_adds
run_input <<HERE
run_main <<HERE
a = 0
b = 20
while( a < b )
@ -19,7 +19,7 @@ HERE
assert_equal 10 , get_return.value
end
def test_ruby_subs
run_input <<HERE
run_main <<HERE
b = 10
while( b >= 1 )
b = b - 1
@ -30,7 +30,7 @@ HERE
assert_equal 0 , get_return.value
end
def test_ruby_adds_fibo
run_input <<HERE
run_main <<HERE
n = 6
a = 0
b = 1

View File

@ -0,0 +1,16 @@
require_relative '../helper'
module Mains
class TestPuts < MiniTest::Test
include Risc::Ticker
def setup;end
def test_say_hi
hi = "Hello there"
run_main "'#{hi}'.putstring"
assert_equal Parfait::Integer , get_return.class
assert_equal hi.length , get_return.value
assert_equal hi , @interpreter.stdout
end
end
end