summaryrefslogtreecommitdiff
path: root/apps/examples/bas/tests/test23.bas
blob: 60b37da8984089f0866de5208f9280d307155ef0 (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
34
35
36
37
38
39
40
#!/bin/sh

echo -n $0: 'Matrix addition and subtraction... '

cat >test.bas <<'eof'
dim a(2,2)
a(2,2)=2.5
dim b%(2,2)
b%(2,2)=3
mat print a
mat a=a-b%
mat print a
dim c$(2,2)
c$(2,1)="hi"
mat print c$
mat c$=c$+c$
mat print c$
eof

cat >test.ref <<'eof'
 0             0            
 0             2.5          
 0             0            
 0            -0.5          
                            
hi                          
                            
hihi                        
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