nuttx-apps/interpreters/bas/test/test49

55 lines
1.5 KiB
Bash

#!/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