summaryrefslogtreecommitdiff
path: root/testsuite/dc.tests (plain)
blob: a5da5372dddd62e66900800dd8c2c6bab788d505
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
9testing "dc basic syntax (stdin, multiple args)" \
10 "dc" \
11 "30\n" \
12 "" "10 20+p"
13
14testing "dc basic syntax (argv, single arg)" \
15 "dc '10 20+p'" \
16 "30\n" \
17 "" ""
18
19testing "dc basic syntax (argv, multiple args)" \
20 "dc 10 20+p" \
21 "30\n" \
22 "" ""
23
24testing "dc complex with spaces (single arg)" \
25 "dc '8 8 * 2 2 + / p'" \
26 "16\n" \
27 "" ""
28
29testing "dc complex without spaces (single arg)" \
30 "dc '8 8*2 2+/p'" \
31 "16\n" \
32 "" ""
33
34testing "dc complex with spaces (multiple args)" \
35 "dc 8 8 \* 2 2 + / p" \
36 "16\n" \
37 "" ""
38
39testing "dc complex without spaces (multiple args)" \
40 "dc 8 8\*2 2+/p" \
41 "16\n" \
42 "" ""
43
44exit $FAILCOUNT
45
46# we do not support arguments
47testing "dc -e <exprs>" \
48 "dc -e '10 2+f'" \
49 "12\n" \
50 "" ""
51
52testing "dc -f <exprs-from-given-file>" \
53 "dc -f input" \
54 "12\n" \
55 "10 2+f" ""
56
57