summaryrefslogtreecommitdiff
path: root/apps/interpreters/bas/test/test49
blob: 0d8bcb455d48cdbbebfef36e117bbc1dcf9fa25f (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh

echo -n $0: 'Matrix determinant... '

cat >test.bas <<'eof'
width 120
dim a(7,7),b(7,7)
mat read a
mat print a;
print
data 58,71,67,36,35,19,60
data 50,71,71,56,45,20,52
data 64,40,84,50,51,43,69
data 31,28,41,54,31,18,33
data 45,23,46,38,50,43,50
data 41,10,28,17,33,41,46
data 66,72,71,38,40,27,69
mat b=inv(a)
mat print b
print det
eof

cat >test.ref <<'eof'
 58  71  67  36  35  19  60 
 50  71  71  56  45  20  52 
 64  40  84  50  51  43  69 
 31  28  41  54  31  18  33 
 45  23  46  38  50  43  50 
 41  10  28  17  33  41  46 
 66  72  71  38  40  27  69 

 9.636025e+07                320206       -537449        2323650      -1.135486e+07                3.019632e+07         
              -9.650941e+07               
 4480          15           -25            108          -528           1404         -4487         
-39436        -131           220          -951           4647         -12358         39497        
 273240        908          -1524          6589         -32198         85625        -273663       
-1846174      -6135          10297        -44519         217549       -578534        1849032      
 1.315035e+07                43699        -73346         317110       -1549606       4120912      -1.31707e+07 

-9.636079e+07               -320208        537452       -2323663       1.135493e+07               -3.019649e+07         
               9.650995e+07               
 1 
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