bc: fix another thinko
[oweals/busybox.git] / testsuite / bc.tests
1 #!/bin/sh
2 # Copyright 2018 by Denys Vlasenko
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 "bc comment 1" \
10         "bc" \
11         "3\n" \
12         "" "1 /* comment */ + 2"
13
14 testing "bc comment 2: /*/ is not a closed comment" \
15         "bc" \
16         "4\n" \
17         "" "1 /*/ + 2 */ + 3"
18
19 testing "bc backslash 1" \
20         "bc" \
21         "3\n" \
22         "" "1 \\\\\n + 2"
23
24 testing "bc string 1" \
25         "bc" \
26         "STR\n" \
27         "" "\"STR\n\""
28
29 tar xJf bc_large.tar.xz
30
31 for f in bc*.bc; do
32         r="`basename "$f" .bc`_results.txt"
33         test -f "$r" || continue
34         # testing "test name" "command" "expected result" "file input" "stdin"
35         testing "bc -lq $f" \
36                 "{ { bc -lq $f 2>&1; echo E:\$? >&2; } | diff -u - $r; echo E:\$?; } 2>&1" \
37                 "E:0\nE:0\n" \
38                 "" ""
39 done
40
41 exit $FAILCOUNT