Bernhard Reutner-Fischer | 70e30e8 | 2015-02-16 17:12:04 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # Copyright 2015 by Bernhard Reutner-Fischer |
| 3 | # Licensed under GPLv2 or later, see file LICENSE in this source tree. |
| 4 | |
| 5 | . ./testing.sh |
| 6 | |
| 7 | # testing "test name" "command" "expected result" "file input" "stdin" |
| 8 | |
| 9 | testing "dc basic syntax (stdin, multiple args)" \ |
| 10 | "dc" \ |
| 11 | "30\n" \ |
| 12 | "" "10 20+p" |
| 13 | |
| 14 | testing "dc basic syntax (argv, single arg)" \ |
| 15 | "dc '10 20+p'" \ |
| 16 | "30\n" \ |
| 17 | "" "" |
| 18 | |
| 19 | testing "dc basic syntax (argv, multiple args)" \ |
| 20 | "dc 10 20+p" \ |
| 21 | "30\n" \ |
| 22 | "" "" |
| 23 | |
| 24 | testing "dc complex with spaces (single arg)" \ |
| 25 | "dc '8 8 * 2 2 + / p'" \ |
| 26 | "16\n" \ |
| 27 | "" "" |
| 28 | |
| 29 | testing "dc complex without spaces (single arg)" \ |
| 30 | "dc '8 8*2 2+/p'" \ |
| 31 | "16\n" \ |
| 32 | "" "" |
| 33 | |
| 34 | testing "dc complex with spaces (multiple args)" \ |
| 35 | "dc 8 8 \* 2 2 + / p" \ |
| 36 | "16\n" \ |
| 37 | "" "" |
| 38 | |
| 39 | testing "dc complex without spaces (multiple args)" \ |
| 40 | "dc 8 8\*2 2+/p" \ |
| 41 | "16\n" \ |
| 42 | "" "" |
| 43 | |
| 44 | exit $FAILCOUNT |
| 45 | |
| 46 | # we do not support arguments |
| 47 | testing "dc -e <exprs>" \ |
| 48 | "dc -e '10 2+f'" \ |
| 49 | "12\n" \ |
| 50 | "" "" |
| 51 | |
| 52 | testing "dc -f <exprs-from-given-file>" \ |
| 53 | "dc -f input" \ |
| 54 | "12\n" \ |
| 55 | "10 2+f" "" |
| 56 | |