bit of renaming and a string test
This commit is contained in:
5
test/risc/mains/README.md
Normal file
5
test/risc/mains/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# Method testing
|
||||
|
||||
Test Whole methods by their output. Using the main method (implicitly)
|
||||
|
||||
Through Interpreter
|
@ -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
|
||||
|
16
test/risc/mains/test_puts.rb
Normal file
16
test/risc/mains/test_puts.rb
Normal 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
|
Reference in New Issue
Block a user