summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-11 13:17:50 -0300
committerAndrés <andmarti@gmail.com>2021-06-11 13:17:50 -0300
commit690053f15860b9d1a85498cc0fd0bc3bed91efc4 (patch)
tree0efa09267f4c2897a850a07063d0202243604160 /tests
parentab0ff4f020b4a65082cddb7cc218bef17ca12c54 (diff)
Added test9
Diffstat (limited to 'tests')
-rw-r--r--tests/test9.sc74
-rwxr-xr-xtests/test9.sh28
2 files changed, 102 insertions, 0 deletions
diff --git a/tests/test9.sc b/tests/test9.sc
new file mode 100644
index 0000000..1dfed9d
--- /dev/null
+++ b/tests/test9.sc
@@ -0,0 +1,74 @@
+# This data file was generated by the Spreadsheet Calculator Improvised (sc-im)
+# You almost certainly shouldn't edit it.
+
+set external_functions
+newsheet "Sheet1"
+movetosheet "Sheet1"
+let A0 = 1
+let B0 = 2
+let C0 = 3
+let D0 = 4
+let E0 = 5
+let F0 = 6
+let G0 = 7
+let H0 = 8
+let I0 = 9
+let J0 = 10
+let K0 = 11
+let L0 = 12
+let M0 = 13
+let N0 = 14
+let O0 = 15
+let P0 = 16
+let Q0 = 17
+let R0 = 18
+let S0 = 29
+let T0 = 30
+let U0 = 31
+let V0 = 32
+let W0 = 33
+let A1 = 2
+let A2 = 3
+let A3 = 4
+let A4 = 5
+let A5 = 6
+let A6 = 7
+let A7 = 8
+let A8 = 9
+let A9 = 10
+let A10 = 11
+let A11 = 12
+let A12 = 13
+let A13 = 14
+let A14 = 15
+let A15 = 16
+let A16 = 17
+let A17 = 18
+let A18 = 19
+let A19 = 20
+let A20 = 21
+let A21 = 22
+let A22 = 23
+let A23 = 24
+let A24 = 25
+let A25 = 26
+let A26 = 27
+let A27 = 28
+let A28 = 29
+let A29 = 30
+let A30 = 31
+let A31 = 32
+let A32 = 33
+let A33 = 34
+let A34 = 35
+let A35 = 36
+let A36 = 37
+let A37 = 38
+let A38 = 39
+let A39 = 40
+let A40 = 41
+let A41 = 42
+let A42 = 43
+let A43 = 44
+let A44 = 45
+goto A1
diff --git a/tests/test9.sh b/tests/test9.sh
new file mode 100755
index 0000000..91383f9
--- /dev/null
+++ b/tests/test9.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+## SEE https://github.com/lehmannro/assert.sh for usage
+
+#Exit immediately if a command exits with a non-zero status.
+set -e
+
+NAME=test9
+
+VALGRIND_CMD='valgrind -v --log-file=${NAME}_vallog --tool=memcheck --track-origins=yes --leak-check=full --show-leak-kinds=all --show-reachable=no'
+. assert.sh
+
+CMD='GOTO ZZ1\nLET ZZ1 = 23\nDELETECOL ZZ\nUNDO\nDELETECOL ZZ\nUNDO\nGETNUM ZZ1'
+assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|Change\|wider'" "23"
+
+#we check valgrind log
+assert_iffound_notcond ${NAME}_vallog "definitely lost.*bytes" "0 bytes"
+assert_iffound_notcond ${NAME}_vallog "indirectly lost.*bytes" "0 bytes"
+assert_iffound_notcond ${NAME}_vallog "possibly lost.*bytes" "0 bytes"
+assert_iffound_notcond ${NAME}_vallog "Uninitialised value was created by a heap allocation"
+assert_iffound_notcond ${NAME}_vallog "Conditional jump or move depends on uninitialised value"
+assert_iffound_notcond ${NAME}_vallog "Invalid read of size"
+assert_iffound_notcond ${NAME}_vallog "Invalid write of size"
+assert_iffound_notcond ${NAME}_vallog "Invalid free() / delete"
+if [ "$1" != "keep-vallog" ];then
+ rm ${NAME}_vallog
+fi
+
+assert_end ${NAME}