summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-07 13:23:53 -0300
committerAndrés <andmarti@gmail.com>2021-06-07 13:23:53 -0300
commitc1cde83eeeb65e15df1d114ece87351440fb908f (patch)
tree8e56481323fb1e3adc808e682c4cefeeb69ce918 /tests
parent9f7a4684a1d1270d9d7b110a09d3999d50306884 (diff)
Added test5: yank and paste with references
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test2.sh2
-rwxr-xr-xtests/test3.sh2
-rwxr-xr-xtests/test4.sh2
-rw-r--r--tests/test5.sc (renamed from tests/mem.sc)8
-rwxr-xr-xtests/test5.sh29
-rw-r--r--tests/tests_to_add2
6 files changed, 40 insertions, 5 deletions
diff --git a/tests/test2.sh b/tests/test2.sh
index 2453c62..09969ec 100755
--- a/tests/test2.sh
+++ b/tests/test2.sh
@@ -14,7 +14,7 @@ assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --node
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 "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"
diff --git a/tests/test3.sh b/tests/test3.sh
index ccc1740..97d3100 100755
--- a/tests/test3.sh
+++ b/tests/test3.sh
@@ -14,7 +14,7 @@ assert "echo GETNUM A0 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --node
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 "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"
diff --git a/tests/test4.sh b/tests/test4.sh
index a132939..f2b6663 100755
--- a/tests/test4.sh
+++ b/tests/test4.sh
@@ -16,7 +16,7 @@ assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --no
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 "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"
diff --git a/tests/mem.sc b/tests/test5.sc
index 6a23128..e260f83 100644
--- a/tests/mem.sc
+++ b/tests/test5.sc
@@ -1,3 +1,9 @@
+# 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 = A0+1
let C0 = B0+1
@@ -146,4 +152,4 @@ let D20 = D19+C20
let E20 = E19+D20
let F20 = F19+E20
let G20 = G19+F20
-goto B20
+goto H1
diff --git a/tests/test5.sh b/tests/test5.sh
new file mode 100755
index 0000000..8ecd1c9
--- /dev/null
+++ b/tests/test5.sh
@@ -0,0 +1,29 @@
+#!/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=test5
+
+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='YANKAREA {"Sheet1"}!G1:G20 "a" 1\nPASTEYANKED "Sheet1" 0 "a"\nGETNUM H20'
+CMD='YANKAREA {"Sheet1"}!G1:G20 "a"\nPASTEYANKED {"Sheet1"} 0 "c"\nGETNUM H20'
+assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp'" "3404115"
+
+#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}
diff --git a/tests/tests_to_add b/tests/tests_to_add
index d8de7e5..d2a1ffe 100644
--- a/tests/tests_to_add
+++ b/tests/tests_to_add
@@ -1,2 +1,2 @@
-yanking and pasting ents
+yanking and pasting ents with reference: test5
memory usage (mem and mem2.sc)