31 lines
1.8 KiB
Ruby
31 lines
1.8 KiB
Ruby
require_relative 'helper'
|
|
|
|
class TestFunctions < MiniTest::Test
|
|
include Fragments
|
|
|
|
def test_hello
|
|
@string_input = <<HERE
|
|
def minus(a,b)
|
|
a - b
|
|
end
|
|
def plus(a, b)
|
|
a + b
|
|
end
|
|
def times(a, b)
|
|
if( b == 0 )
|
|
a = 0
|
|
else
|
|
m = minus(b, 1)
|
|
t = times(a, m)
|
|
a = plus(a,t)
|
|
end
|
|
end
|
|
|
|
putint(times(7,6))
|
|
HERE
|
|
@should = [0x0,0xb0,0xa0,0xe3,0x7,0x10,0xa0,0xe3,0x6,0x20,0xa0,0xe3,0xc,0x0,0x0,0xeb,0x7,0x10,0xa0,0xe1,0x32,0x0,0x0,0xeb,0x1,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x40,0x2d,0xe9,0x2,0x30,0x41,0xe0,0x3,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x2,0x30,0x81,0xe0,0x3,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x0,0x0,0x52,0xe3,0x10,0x0,0x0,0xa,0x6,0x0,0x2d,0xe9,0x2,0x10,0xa0,0xe1,0x1,0x20,0xa0,0xe3,0xf0,0xff,0xff,0xeb,0x6,0x0,0xbd,0xe8,0x7,0x30,0xa0,0xe1,0xe,0x0,0x2d,0xe9,0x3,0x20,0xa0,0xe1,0xf3,0xff,0xff,0xeb,0xe,0x0,0xbd,0xe8,0x7,0x40,0xa0,0xe1,0x1e,0x0,0x2d,0xe9,0x4,0x20,0xa0,0xe1,0xea,0xff,0xff,0xeb,0x1e,0x0,0xbd,0xe8,0x7,0x10,0xa0,0xe1,0x0,0x0,0x0,0xea,0x0,0x10,0xa0,0xe3,0x1,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0xa,0x30,0x42,0xe2,0x22,0x21,0x42,0xe0,0x22,0x22,0x82,0xe0,0x22,0x24,0x82,0xe0,0x22,0x28,0x82,0xe0,0xa2,0x21,0xa0,0xe1,0x2,0x41,0x82,0xe0,0x84,0x30,0x53,0xe0,0x1,0x20,0x82,0x52,0xa,0x30,0x83,0x42,0x30,0x30,0x83,0xe2,0x0,0x30,0xc1,0xe5,0x1,0x10,0x41,0xe2,0x0,0x0,0x52,0xe3,0xef,0xff,0xff,0x1b,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x1,0x20,0xa0,0xe1,0x20,0x10,0x8f,0xe2,0x9,0x10,0x81,0xe2,0xe9,0xff,0xff,0xeb,0x14,0x10,0x8f,0xe2,0xc,0x20,0xa0,0xe3,0x1,0x0,0xa0,0xe3,0x4,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x0]
|
|
parse
|
|
write "functions"
|
|
end
|
|
end
|