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