summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndrés <andmarti@gmail.com>2021-06-08 22:38:28 -0300
committerAndrés <andmarti@gmail.com>2021-06-08 22:38:28 -0300
commit1bb11b8d2f158df6ced946833f357e656e00856d (patch)
treec1ba985b249c85de8f64334bb443b669bd5e882f /tests
parentc1cde83eeeb65e15df1d114ece87351440fb908f (diff)
Fix not updating graph correctly after yanking cells with references, pasting them with Pc and undoing them. Added test6 and test7 for that.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test5.sh1
-rw-r--r--tests/test6.sc (renamed from tests/mem2.sc)15
-rwxr-xr-xtests/test6.sh28
-rw-r--r--tests/test7.sc155
-rwxr-xr-xtests/test7.sh29
-rw-r--r--tests/tests_to_add13
6 files changed, 228 insertions, 13 deletions
diff --git a/tests/test5.sh b/tests/test5.sh
index 8ecd1c9..89bfe0d 100755
--- a/tests/test5.sh
+++ b/tests/test5.sh
@@ -9,7 +9,6 @@ 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"
diff --git a/tests/mem2.sc b/tests/test6.sc
index 9879726..f1a3e7b 100644
--- a/tests/mem2.sc
+++ b/tests/test6.sc
@@ -1,19 +1,14 @@
-# This data file was generated by the Spreadsheet Calculator Improvised (SC-IM)
+# 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 = 12
let A1 = A0+1
let B1 = A1+B0
let A2 = A1+1
let B2 = A2+B1
-let A3 = A2+1
-let B3 = A3+B2
-let A4 = A3+1
-let B4 = A4+B3
-let A5 = A4+1
-let B5 = A5+B4
-let A6 = A5+1
-let B6 = A6+B5
-goto A1
+goto C1
diff --git a/tests/test6.sh b/tests/test6.sh
new file mode 100755
index 0000000..bd2faf4
--- /dev/null
+++ b/tests/test6.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=test6
+
+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"}!B1:B2 "a"\nPASTEYANKED {"Sheet1"} 0 "c"\nGETNUM C1\nUNDO\nPASTEYANKED {"Sheet1"} 0 "c"\nGETNUM C2'
+assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|Change'" "16\n23"
+
+#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/test7.sc b/tests/test7.sc
new file mode 100644
index 0000000..68db441
--- /dev/null
+++ b/tests/test7.sc
@@ -0,0 +1,155 @@
+# 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
+let D0 = C0+1
+let E0 = D0+1
+let F0 = E0+1
+let G0 = F0+1
+let H0 = G0+1
+let A1 = A0+1
+let B1 = A1+B0
+let C1 = C0+B1
+let D1 = D0+C1
+let E1 = E0+D1
+let F1 = F0+E1
+let G1 = G0+F1
+let A2 = A1+1
+let B2 = A2+B1
+let C2 = C1+B2
+let D2 = D1+C2
+let E2 = E1+D2
+let F2 = F1+E2
+let G2 = G1+F2
+let A3 = A2+1
+let B3 = A3+B2
+let C3 = C2+B3
+let D3 = D2+C3
+let E3 = E2+D3
+let F3 = F2+E3
+let G3 = G2+F3
+let A4 = A3+1
+let B4 = A4+B3
+let C4 = C3+B4
+let D4 = D3+C4
+let E4 = E3+D4
+let F4 = F3+E4
+let G4 = G3+F4
+let A5 = A4+1
+let B5 = A5+B4
+let C5 = C4+B5
+let D5 = D4+C5
+let E5 = E4+D5
+let F5 = F4+E5
+let G5 = G4+F5
+let A6 = A5+1
+let B6 = A6+B5
+let C6 = C5+B6
+let D6 = D5+C6
+let E6 = E5+D6
+let F6 = F5+E6
+let G6 = G5+F6
+let A7 = A6+1
+let B7 = A7+B6
+let C7 = C6+B7
+let D7 = D6+C7
+let E7 = E6+D7
+let F7 = F6+E7
+let G7 = G6+F7
+let A8 = A7+1
+let B8 = A8+B7
+let C8 = C7+B8
+let D8 = D7+C8
+let E8 = E7+D8
+let F8 = F7+E8
+let G8 = G7+F8
+let A9 = A8+1
+let B9 = A9+B8
+let C9 = C8+B9
+let D9 = D8+C9
+let E9 = E8+D9
+let F9 = F8+E9
+let G9 = G8+F9
+let A10 = A9+1
+let B10 = A10+B9
+let C10 = C9+B10
+let D10 = D9+C10
+let E10 = E9+D10
+let F10 = F9+E10
+let G10 = G9+F10
+let A11 = A10+1
+let B11 = A11+B10
+let C11 = C10+B11
+let D11 = D10+C11
+let E11 = E10+D11
+let F11 = F10+E11
+let G11 = G10+F11
+let A12 = A11+1
+let B12 = A12+B11
+let C12 = C11+B12
+let D12 = D11+C12
+let E12 = E11+D12
+let F12 = F11+E12
+let G12 = G11+F12
+let A13 = A12+1
+let B13 = A13+B12
+let C13 = C12+B13
+let D13 = D12+C13
+let E13 = E12+D13
+let F13 = F12+E13
+let G13 = G12+F13
+let A14 = A13+1
+let B14 = A14+B13
+let C14 = C13+B14
+let D14 = D13+C14
+let E14 = E13+D14
+let F14 = F13+E14
+let G14 = G13+F14
+let A15 = A14+1
+let B15 = A15+B14
+let C15 = C14+B15
+let D15 = D14+C15
+let E15 = E14+D15
+let F15 = F14+E15
+let G15 = G14+F15
+let A16 = A15+1
+let B16 = A16+B15
+let C16 = C15+B16
+let D16 = D15+C16
+let E16 = E15+D16
+let F16 = F15+E16
+let G16 = G15+F16
+let A17 = A16+1
+let B17 = A17+B16
+let C17 = C16+B17
+let D17 = D16+C17
+let E17 = E16+D17
+let F17 = F16+E17
+let G17 = G16+F17
+let A18 = A17+1
+let B18 = A18+B17
+let C18 = C17+B18
+let D18 = D17+C18
+let E18 = E17+D18
+let F18 = F17+E18
+let G18 = G17+F18
+let A19 = A18+1
+let B19 = A19+B18
+let C19 = C18+B19
+let D19 = D18+C19
+let E19 = E18+D19
+let F19 = F18+E19
+let G19 = G18+F19
+let A20 = A19+1
+let B20 = A20+B19
+let C20 = C19+B20
+let D20 = D19+C20
+let E20 = E19+D20
+let F20 = F19+E20
+let G20 = G19+F20
+goto A7
diff --git a/tests/test7.sh b/tests/test7.sh
new file mode 100755
index 0000000..91dc04c
--- /dev/null
+++ b/tests/test7.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=test7
+
+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='LET A7=90\nGETNUM A20\nGETNUM G20\nUNDO\nREDO\nGETNUM A20\nGETNUM G20'
+
+assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|Change'" "103\n954958\n103\n954958"
+
+#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 d2a1ffe..2aeecdc 100644
--- a/tests/tests_to_add
+++ b/tests/tests_to_add
@@ -1,2 +1,11 @@
-yanking and pasting ents with reference: test5
-memory usage (mem and mem2.sc)
+DONE:
+test1: multiple sheets that have formula dependency from one to another
+test2: multiple sheets that have formula dependency from one to another (with undo/redo)
+test3: multiple sheets that have formulas dependencies from one to another
+test4: multiple sheets that have formulas dependencies from one to another (with undo/redo)
+test5: yanking and pasting ents keeping references (Pc) - timing and memory usage
+test6: yanking and pasting ents keeping references (Pc) - with undo
+
+TODO:
+test7: yanking and pasting ents keeping references (Pc) (with undo and redo)
+fails to restore some ents formulas.