summaryrefslogtreecommitdiff
path: root/apps/examples/bas/tests/test16.bas
blob: 9e994238106352da26bb189a2078fc557f5302dd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

echo -n $0: 'SWAP... '

cat >test.bas <<'eof'
a=1 : b=2
print "a=";a;"b=";b
swap a,b
print "a=";a;"b=";b
dim a$(1,1),b$(1,1)
a$(1,0)="a" : b$(0,1)="b"
print "a$(1,0)=";a$(1,0);"b$(0,1)=";b$(0,1)
swap a$(1,0),b$(0,1)
print "a$(1,0)=";a$(1,0);"b$(0,1)=";b$(0,1)
eof

cat >test.ref <<'eof'
a= 1 b= 2 
a= 2 b= 1 
a$(1,0)=ab$(0,1)=b
a$(1,0)=bb$(0,1)=a
eof

sh ./test/runbas test.bas >test.data

if cmp test.ref test.data
then
  rm -f test.*
  echo passed
else
  echo failed
  exit 1
fi