0026-dc.sh - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
0026-dc.sh (729B)
---
1 #!/bin/sh
2
3 tmp=$$.tmp
4
5 trap 'rm -f $tmp' EXIT
6 trap 'exit $?' HUP INT TERM
7
8 # Expected output for printnum tests
9 cat <<EOF >$tmp
10 test 1:
11 100
12 test 2:
13 0
14 test 3:
15 -42
16 test 4:
17 .5
18 test 5:
19 .05
20 test 6:
21 .001
22 test 7:
23 1.5
24 test 8:
25 -.5
26 test 9:
27 -1.25
28 test 10:
29 .4
30 test 11:
31 .0
32 .1
33 test 12:
34 .0
35 test 13:
36 1.0
37 test 14:
38 .2
39 test 15:
40 .1
41 test 16:
42 .01
43 test 17:
44 .001
45 test 18:
46 .8
47 EOF
48
49 $EXEC ../dc <<EOF | diff -u $tmp -
50 [test 1:]pc 100p
51 [test 2:]pc 0p
52 [test 3:]pc _42p
53 [test 4:]pc .5p
54 [test 5:]pc .05p
55 [test 6:]pc .001p
56 [test 7:]pc 1.5p
57 [test 8:]pc _.5p
58 [test 9:]pc _1.25p
59 [test 10:]pc 16o.3p
60 [test 11:]pc 2o.1p10op
61 [test 12:]pc 2o.3p
62 [test 13:]pc 2o1.1p
63 [test 14:]pc 3o.7p
64 [test 15:]pc 2o.5p
65 [test 16:]pc 2o.25p
66 [test 17:]pc 2o.125p
67 [test 18:]pc 16o.5p
68 EOF