#!/bin/sh

source $testsuitedir/lib_test.sh

cat > PROGRAMME << EOP
	:write :stdout ~s @&0
	:write :stdout ~s @(&1+1)
	:write :stdout ~s @s
	:write :stdout ~s @(s+1)
	:write :stdout ~s @&@p
	:write :stdout ~s @(&@pp+1)
	:write :stdout ~s @&@(pp-1)
EOP

cat > MEMOIRE_INITIALE << EOM
# Memory:
#> &0 : STR "one\n"
#> &1 : INT
#> &2 : STR "two\n"
#> &5 / s : STR "three\n"
#> &6 : STR "four\n"
#> &8 : STR "five\n"
#> &10 / p : PTR &8
#> &14 : PTR &25
#> &15 / pp : PTR &20
#> &21 : STR "six\n"
#> &25 : STR "seven\n"
# Aliases:
# p -> &10
# pp -> &15
# s -> &5
# Free addresses:
# From &3 on 2 addresses
# From &7 on 1 addresses
# From &9 on 1 addresses
# From &11 on 3 addresses
# From &16 on 5 addresses
# From &22 on 3 addresses
# Free blocks:
# Block of 1 free addresses from &7
# Block of 1 free addresses from &9
# Block of 2 free addresses from &3
# Block of 3 free addresses from &11
# Block of 3 free addresses from &22
# Block of 5 free addresses from &16
# End of memory
EOM

cat > MEMOIRE_REF << EOM
# Memory:
#> &0 : STR "one\n"
#> &1 : INT
#> &2 : STR "two\n"
#> &5 / s : STR "three\n"
#> &6 : STR "four\n"
#> &8 : STR "five\n"
#> &10 / p : PTR &8
#> &14 : PTR &25
#> &15 / pp : PTR &20
#> &21 : STR "six\n"
#> &25 : STR "seven\n"
# Aliases:
# p -> &10
# pp -> &15
# s -> &5
# Free addresses:
# From &3 on 2 addresses
# From &7 on 1 addresses
# From &9 on 1 addresses
# From &11 on 3 addresses
# From &16 on 5 addresses
# From &22 on 3 addresses
# Free blocks:
# Block of 1 free addresses from &7
# Block of 1 free addresses from &9
# Block of 2 free addresses from &3
# Block of 3 free addresses from &11
# Block of 3 free addresses from &22
# Block of 5 free addresses from &16
# End of memory
EOM

cat > STDOUT_REF << EOS
one
two
three
four
five
six
seven
EOS

cat > STDERR_REF << EOS
EOS

cat > CODE_RETOUR_REF << EOC
0
EOC

test_basique
