#!/bin/sh

source $testsuitedir/lib_test.sh

cat > PROGRAMME << EOP
	:write :stdout ~s "before\n"
	:goto child :when :clone \$comm
	:write :stdout ~s "father\n"
	:write \$comm ~s "ping\n"
	:write :stdout ~s "father waiting for pong reply\n"
	:new STR
	:read \$comm ~s LINE -> &0
	"father: " + @&0 -> &0
	@&0 + "\n" -> &0
	:write :stdout ~s @&0
	:delete &0
	:write :stdout ~s "after\n"
	:close \$comm
	:shutdown
:label child
	:new STR
	:read \$comm ~s LINE -> &0
	"child: " + @&0 -> &0
	@&0 + "\n" -> &0
	:write :stdout ~s @&0
	:delete &0
	:write \$comm ~s "pong\n"
	:close \$comm
	:shutdown -1

EOP

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

cat > MEMOIRE_REF << EOM
# Memory:
# Aliases:
# Free addresses:
# From &0 on 1 addresses
# Free blocks:
# Block of 1 free addresses from &0
# End of memory
EOM

cat > STDOUT_REF << EOS
before
father
father waiting for pong reply
child: ping
father: pong
after
EOS

cat > STDERR_REF << EOS
EOS

cat > CODE_RETOUR_REF << EOC
0
EOC

test_basique
