2015-02-16 21:42:04 +05:30
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2015 by Bernhard Reutner-Fischer
|
|
|
|
# Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
|
|
|
|
|
|
|
. ./testing.sh
|
|
|
|
|
|
|
|
# testing "test name" "command" "expected result" "file input" "stdin"
|
|
|
|
|
|
|
|
testing "dc basic syntax (stdin, multiple args)" \
|
|
|
|
"dc" \
|
|
|
|
"30\n" \
|
|
|
|
"" "10 20+p"
|
|
|
|
|
|
|
|
testing "dc basic syntax (argv, single arg)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e'10 20+p'" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"30\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "dc basic syntax (argv, multiple args)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e10 -e20+p" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"30\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "dc complex with spaces (single arg)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e'8 8 * 2 2 + / p'" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"16\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "dc complex without spaces (single arg)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e'8 8*2 2+/p'" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"16\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "dc complex with spaces (multiple args)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e8 -e8 -e\* -e2 -e2 -e+ -e/ -ep" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"16\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
testing "dc complex without spaces (multiple args)" \
|
2018-12-06 23:16:42 +05:30
|
|
|
"dc -e8 -e8\*2 -e2+/p" \
|
2015-02-16 21:42:04 +05:30
|
|
|
"16\n" \
|
|
|
|
"" ""
|
|
|
|
|
|
|
|
exit $FAILCOUNT
|