fix the lasts tests
This commit is contained in:
@ -38,9 +38,9 @@ module Fragments
|
||||
assembly = writer.text
|
||||
writer.save("#{name}.o")
|
||||
function = @object_space.classes[@target[0]]
|
||||
assert function
|
||||
assert function , "no class #{@target[0]}"
|
||||
function = function.get_function(@target[1])
|
||||
assert function
|
||||
assert function , "no function #{@target[1]} for class #{@target[0]}"
|
||||
io = StringIO.new
|
||||
function.assemble io
|
||||
assembly = io.string
|
||||
|
@ -25,5 +25,22 @@ HERE
|
||||
parse
|
||||
write "while"
|
||||
end
|
||||
|
||||
# a hand coded version of the fibonachi numbers (moved to kernel to be able to call it)
|
||||
# not my hand off course, found in the net from a basic introduction
|
||||
def test_kernel_fibo
|
||||
int = Vm::Integer.new(1)
|
||||
fibo = @object_space.get_or_create_class(:Object).get_or_create_function(:fibo)
|
||||
main = @object_space.main.scope binding
|
||||
main.int = 10
|
||||
ret = main.call( fibo )
|
||||
main.mov( :r1 , :r7 )
|
||||
putint = @object_space.get_or_create_class(:Object).get_or_create_function(:putint)
|
||||
@object_space.main.call( putint )
|
||||
@should = [0x0,0x40,0x2d,0xe9,0x1,0x0,0x51,0xe3,0x1,0x70,0xa0,0xd1,0xe,0xf0,0xa0,0xd1,0x1c,0x40,0x2d,0xe9,0x1,0x30,0xa0,0xe3,0x0,0x40,0xa0,0xe3,0x2,0x20,0x41,0xe2,0x4,0x30,0x83,0xe0,0x4,0x40,0x43,0xe0,0x1,0x20,0x52,0xe2,0xfb,0xff,0xff,0x5a,0x3,0x70,0xa0,0xe1,0x1c,0x80,0xbd,0xe8,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x1,0x0,0x51,0xe3,0x1,0x70,0xa0,0xd1,0xe,0xf0,0xa0,0xd1,0x1c,0x40,0x2d,0xe9,0x1,0x30,0xa0,0xe3,0x0,0x40,0xa0,0xe3,0x2,0x20,0x41,0xe2,0x4,0x30,0x83,0xe0,0x4,0x40,0x43,0xe0,0x1,0x20,0x52,0xe2,0xfb,0xff,0xff,0x5a,0x3,0x70,0xa0,0xe1,0x1c,0x80,0xbd,0xe8,0x0,0x80,0xbd,0xe8]
|
||||
@target = [:Object , :fibo]
|
||||
write "fibo"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user