more fragment tests
This commit is contained in:
@ -11,26 +11,23 @@ def fibonaccit(n) # n == r0
|
||||
while( n > 1 ) do #BUG comment lines + comments behind function calls
|
||||
tmp = a # r3 <- r1
|
||||
a = b # r1 <- r2
|
||||
b = tmp + b # r4 = r2 + r3 (r4 transient) r2 <- r4
|
||||
n = n - 1 # r0 <- r2 for call, #call ok
|
||||
end #r5 <- r0 - 1 n=n-1 through r5 tmp
|
||||
b = tmp + b # r4 = r2 + r3 (r4 transient) r2 <- r4
|
||||
n = n - 1 # r0 <- r2 for call, #call ok
|
||||
end #r5 <- r0 - 1 n=n-1 through r5 tmp
|
||||
b.putint()
|
||||
return b
|
||||
end # r0 <- r5
|
||||
|
||||
fibonaccit( 10 )
|
||||
HERE
|
||||
@should = [0x0,0x40,0x2d,0xe9,0x0,0x40,0xa0,0xe3,0x1,0x50,0xa0,0xe3,0x1,0x0,0x53,0xe3,0x4,0x0,0x0,0xda,0x4,0x60,0xa0,0xe1,0x5,0x40,0xa0,0xe1,0x5,0x50,0x86,0xe0,0x1,0x30,0x43,0xe2,0xf8,0xff,0xff,0xea,0x20,0x0,0x2d,0xe9,0x5,0x20,0xa0,0xe1,0xd4,0xff,0xff,0xeb,0x20,0x0,0xbd,0xe8,0x5,0x0,0xa0,0xe1,0x0,0x80,0xbd,0xe8]
|
||||
@output = " 55 "
|
||||
@target = [:Object , :fibonaccit]
|
||||
parse
|
||||
write "while"
|
||||
@expect = [Virtual::Return ]
|
||||
check
|
||||
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 = Register::Integer.new(Virtual::RegisterMachine.instance.receiver_register)
|
||||
def ttest_kernel_fibo
|
||||
int = Register::Integer.new(Virtual::RegisterMachine.instance.receiver_register)
|
||||
fibo = @object_space.get_class_by_name(:Object).resolve_method(:fibo)
|
||||
main = @object_space.main
|
||||
main.mov int , 10
|
||||
@ -44,4 +41,3 @@ HERE
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user