
#!/bin/sh

source $testsuitedir/lib_test.sh

cat > PROGRAMME << EOP
	:new PTR, INT, INT
	10 -> &1
	:call fibonacci &0
	:delete &0,&1
	:shutdown
:label fibonacci # PTR iINT oINT
	:goto calcul_fib :when @(:current+1)>1
	@(:current+1) -> (:current+2)
	:return
:label calcul_fib
	:new PTR , INT , INT , PTR , INT , INT -> :current
	@(:current+1) - 1 -> (&@:current+1)
	:call fibonacci &@:current
	@(:current+1) - 2 -> (&@:current+4)
	:call fibonacci (&@:current+3)
	@(&@:current+2) + @(&@:current+5) -> (:current+2)
	:delete &@:current*6
	:return
EOP

cat > MEMOIRE_INITIALE << EOM
# Memory:
# Aliases:
# Free addresses:
# Free blocks:
# End of memory
EOM

cat > MEMOIRE_REF << EOM
# Memory:
#> &2 : INT 55
# Aliases:
# Free addresses:
# From &0 on 2 addresses
# From &3 on 54 addresses
# Free blocks:
# Block of 2 free addresses from &0
# Block of 54 free addresses from &3
# End of memory
EOM

cat > STDOUT_REF << EOS
EOS

cat > STDERR_REF << EOS
EOS

cat > CODE_RETOUR_REF << EOC
0
EOC

test_basique
