renaming and small fixes

This commit is contained in:
Torsten Ruger
2014-06-08 00:56:40 +03:00
parent e7bb774da0
commit fbcfa844de
6 changed files with 42 additions and 36 deletions

View File

@ -7,9 +7,9 @@ class TestIf < MiniTest::Test
@string_input = <<HERE
def itest(n)
if( n < 12)
putstring("then")
"then".putstring()
else
putstring("else")
"else".putstring()
end
end

View File

@ -11,11 +11,16 @@ def fibonaccir( n )
else
a = fibonaccir( n - 1 )
b = fibonaccir( n - 2 )
c = fibonaccir( n - 3 )
return a + b
end
end
fib = fibonaccir( 10 )
fib.putint()
end
def fib_print(n)
fib = fibonaccir( n )
fib.putint()
end
fib_print(10)
HERE
@should = [0x0,0x40,0x2d,0xe9,0x1,0x0,0x51,0xe3,0xe,0x0,0x0,0xda,0x1,0x20,0x41,0xe2,0x6,0x0,0x2d,0xe9,0x2,0x10,0xa0,0xe1,0xf8,0xff,0xff,0xeb,0x6,0x0,0xbd,0xe8,0x7,0x30,0xa0,0xe1,0x2,0x40,0x41,0xe2,0x1e,0x0,0x2d,0xe9,0x4,0x10,0xa0,0xe1,0xf2,0xff,0xff,0xeb,0x1e,0x0,0xbd,0xe8,0x7,0x50,0xa0,0xe1,0x5,0x60,0x83,0xe0,0x6,0x70,0xa0,0xe1,0x0,0x0,0x0,0xea,0x1,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x1,0x0,0x51,0xe3,0xe,0x0,0x0,0xda,0x1,0x20,0x41,0xe2,0x6,0x0,0x2d,0xe9,0x2,0x10,0xa0,0xe1,0xf8,0xff,0xff,0xeb,0x6,0x0,0xbd,0xe8,0x7,0x30,0xa0,0xe1,0x2,0x40,0x41,0xe2,0x1e,0x0,0x2d,0xe9,0x4,0x10,0xa0,0xe1,0xf2,0xff,0xff,0xeb,0x1e,0x0,0xbd,0xe8,0x7,0x50,0xa0,0xe1,0x5,0x60,0x83,0xe0,0x6,0x70,0xa0,0xe1,0x0,0x0,0x0,0xea,0x1,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8]
@output = " 55 "