0039-dc.sh - sbase - suckless unix tools
HTML git clone git://git.suckless.org/sbase
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
0039-dc.sh (1480B)
---
1 #!/bin/sh
2
3 tmp=$$.tmp
4
5 trap 'rm -f $tmp' EXIT
6 trap 'exit $?' HUP INT TERM
7
8 # Test s, l, S, L register commands
9 $EXEC ../dc <<'EOF' >$tmp 2>&1
10 [test 1:]pc 5 sa la p c
11 [test 2:]pc lz p c
12 [test 3:]pc 1 sb 2 lb p c
13 [test 4:]pc 1 sc 2 sc lc p c
14 [test 5:]pc 1 sd ld ld +p c
15 [test 6:]pc 5 Se le p c
16 [test 7:]pc 1 Sf 2 Sf 3 Sf lf p c
17 [test 8:]pc 1 Sg 2 Sg Lg p c
18 [test 9:]pc 1 Sh 2 Sh Lh Lh +p c
19 [test 10:]pc 1 Si Li p c
20 [test 11:]pc 1 sj 2 Sj 3 Sj Lj Lj lj p c
21 [test 12:]pc _42 sk lk p c
22 [test 13:]pc 1.5 sl ll p c
23 [test 14:]pc 99999999999999999999 sm lm p c
24 [test 15:]pc [hello] sn ln p c
25 [test 16:]pc 1 so 2 sp lo lp +p c
26 [test 17:]pc 1 Sq 2 Sr Lq Lr +p c
27 [test 18:]pc 1 St 2 St 3 St Lt p Lt p Lt p c
28 [test 19:]pc 1 2 3 Su Su Su Lu Lu Lu + +p c
29 [test 20:]pc 1 sv lv lv lv + +p c
30 [test 21:]pc 1 Sw 2 Sw 3 Sw 4 Sw 5 Sw Lw p Lw p Lw p Lw p Lw p c
31 [test 22:]pc 1 Sx 2 Sy 3 Sx 4 Sy Lx Ly * Lx Ly * +p c
32 [test 23:]pc 42 s0 100 S0 L0 p L0 p c
33 [test 24:]pc LA
34 [test 25:]pc 1 SB LB LB
35 [test 26:]pc sC
36 [test 27:]pc SD
37 EOF
38
39 diff -u - $tmp <<'EOF'
40 ../dc: stack register 'A' (101) is empty
41 ../dc: stack register 'B' (102) is empty
42 ../dc: stack empty
43 ../dc: stack empty
44 test 1:
45 5
46 test 2:
47 0
48 test 3:
49 1
50 test 4:
51 2
52 test 5:
53 2
54 test 6:
55 5
56 test 7:
57 3
58 test 8:
59 2
60 test 9:
61 3
62 test 10:
63 1
64 test 11:
65 1
66 test 12:
67 -42
68 test 13:
69 1.5
70 test 14:
71 99999999999999999999
72 test 15:
73 hello
74 test 16:
75 3
76 test 17:
77 3
78 test 18:
79 3
80 2
81 1
82 test 19:
83 6
84 test 20:
85 3
86 test 21:
87 5
88 4
89 3
90 2
91 1
92 test 22:
93 14
94 test 23:
95 100
96 42
97 test 24:
98 test 25:
99 test 26:
100 test 27:
101 EOF