diff options
author | Andrés <andmarti@gmail.com> | 2021-06-02 18:37:17 -0300 |
---|---|---|
committer | Andrés <andmarti@gmail.com> | 2021-06-02 18:37:17 -0300 |
commit | 619ded1af207f95fb8d93b0f120e0ad9d36daadf (patch) | |
tree | 67460b4eca1e75ca3b7952e1fe912e31c8eb841b /tests | |
parent | f94b16bfb779d6c5279628030dfe6f992518735d (diff) |
Added test3 and test4
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test1.sh | 4 | ||||
-rwxr-xr-x | tests/test2.sh | 2 | ||||
-rw-r--r-- | tests/test3.sc | 15 | ||||
-rwxr-xr-x | tests/test3.sh | 18 | ||||
-rw-r--r-- | tests/test4.sc | 14 | ||||
-rwxr-xr-x | tests/test4.sh | 20 |
6 files changed, 70 insertions, 3 deletions
diff --git a/tests/test1.sh b/tests/test1.sh index 661219d..4283c7a 100755 --- a/tests/test1.sh +++ b/tests/test1.sh @@ -13,6 +13,6 @@ assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --node #TODO: check valgrind log here #"in use at exit: 0 bytes in 0 blocks" #"All heap blocks were freed -- no leaks are possible" - rm ${NAME}_vallog -assert_end test1 + +assert_end ${NAME} diff --git a/tests/test2.sh b/tests/test2.sh index c514f2a..ec906c7 100755 --- a/tests/test2.sh +++ b/tests/test2.sh @@ -13,6 +13,6 @@ assert "echo GETNUM C2 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --node #TODO: check valgrind log here #"in use at exit: 0 bytes in 0 blocks" #"All heap blocks were freed -- no leaks are possible" +#rm ${NAME}_vallog -rm ${NAME}_vallog assert_end ${NAME} diff --git a/tests/test3.sc b/tests/test3.sc new file mode 100644 index 0000000..334014d --- /dev/null +++ b/tests/test3.sc @@ -0,0 +1,15 @@ +# This data file was generated by the Spreadsheet Calculator Improvised (sc-im) +# You almost certainly shouldn't edit it. + +newsheet "Sheet1" +newsheet "dos" +movetosheet "dos" +let A0 = 1.14 +let A1 = 1.16 +let A2 = @sum(A0:A1) +let B3 = {"Sheet1"}!A2 +goto B3 +movetosheet "Sheet1" +let A0 = {"dos"}!B3+{"dos"}!A2 +let A2 = 1 +goto A2 diff --git a/tests/test3.sh b/tests/test3.sh new file mode 100755 index 0000000..1216a2c --- /dev/null +++ b/tests/test3.sh @@ -0,0 +1,18 @@ +#!/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=test3 + +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 +assert "echo GETNUM A0 | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|left'" "3.3" + +#TODO: check valgrind log here +#"in use at exit: 0 bytes in 0 blocks" +#"All heap blocks were freed -- no leaks are possible" +#rm ${NAME}_vallog + +assert_end ${NAME} diff --git a/tests/test4.sc b/tests/test4.sc new file mode 100644 index 0000000..90df593 --- /dev/null +++ b/tests/test4.sc @@ -0,0 +1,14 @@ +# This data file was generated by the Spreadsheet Calculator Improvised (sc-im) +# You almost certainly shouldn't edit it. + +newsheet "Sheet1" +newsheet "dos" +movetosheet "dos" +let A0 = 1.14 +let A1 = 1.16 +let A2 = @sum(A0:A1) +let B3 = {"Sheet1"}!A2 +goto B3 +movetosheet "Sheet1" +let A0 = {"dos"}!B3+{"dos"}!A2 +goto A2 diff --git a/tests/test4.sh b/tests/test4.sh new file mode 100755 index 0000000..f76e863 --- /dev/null +++ b/tests/test4.sh @@ -0,0 +1,20 @@ +#!/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=test4 + +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 A2 = 1\nUNDO\nGETNUM A0\nGETNUM {"dos"}!B3' +assert "echo -e '${CMD}' | $VALGRIND_CMD ../src/sc-im ${NAME}.sc --nocurses --nodebug --quit_afterload 2>&1 |grep -v '^$\|Interp\|left\|Change'" "2.3\n0" + +#TODO: check valgrind log here +#"in use at exit: 0 bytes in 0 blocks" +#"All heap blocks were freed -- no leaks are possible" +#rm ${NAME}_vallog + +assert_end ${NAME} |