0044-dc.sh - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
0044-dc.sh (1054B)
---
1 #!/bin/sh
2
3 set -e
4
5 tmp=$$.tmp
6
7 trap 'rm -f $tmp' EXIT
8 trap 'exit $?' HUP INT TERM
9
10 # Expected output for line wrapping tests (derived from system dc)
11 cat <<'EOF' >$tmp
12 test 1:
13 327339060789614187001318969682759915221664204604306478948329136809613\
14 379640467455488327009232590415715088668412756007100921725654588539305\
15 3328527589376
16 test 2:
17 -32733906078961418700131896968275991522166420460430647894832913680961\
18 337964046745548832700923259041571508866841275600710092172565458853930\
19 53328527589376
20 test 3:
21 .33333333333333333333333333333333333333333333333333333333333333333333\
22 33333333333333333333333333333333
23 test 4:
24 123456789012345678901234567890123456789012345678901234567890123456789
25 test 5:
26 123456789012345678901234567890123456789012345678901234567890123456789\
27 0
28 EOF
29
30 $EXEC ../dc <<'EOF' | diff -u $tmp -
31 [test 1:]pc 2 500^ p
32 [test 2:]pc 0 2 500^ - p
33 [test 3:]pc 100k 1 3 / p
34 [test 4:]pc 123456789012345678901234567890123456789012345678901234567890123456789 p
35 [test 5:]pc 1234567890123456789012345678901234567890123456789012345678901234567890 p
36 EOF