0042-dc.sh (1602B)
1 #!/bin/sh 2 3 tmp=$$.tmp 4 5 trap 'rm -f $tmp' EXIT 6 trap 'exit $?' HUP INT TERM 7 8 # Test : and ; array commands 9 $EXEC ../dc <<'EOF' >$tmp 2>&1 10 [test 1:]pc 42 0:a 0;a p c 11 [test 2:]pc 10 0:b 20 1:b 30 2:b 0;b p 1;b p 2;b p c 12 [test 3:]pc 100 5:c 5;c p c 13 [test 4:]pc _42 0:d 0;d p c 14 [test 5:]pc 1.5 0:e 0;e p c 15 [test 6:]pc 99999999999999999999 0:f 0;f p c 16 [test 7:]pc [hello] 0:g 0;g p c 17 [test 8:]pc 1 0:h 2 0:h 0;h p c 18 [test 9:]pc 5 10:i 10;i p c 19 [test 10:]pc 1 0:j 2 1:j 3 2:j 0;j 1;j + 2;j +p c 20 [test 11:]pc 100 0:k 0;k 0;k *p c 21 [test 12:]pc 7 3:l 3;l 3;l 3;l + +p c 22 [test 13:]pc 1 0:0 2 1:0 0;0 1;0 +p c 23 [test 14:]pc 50 0:m 0;m 2/p c 24 [test 15:]pc 10 0:n 0;n 5 * 2:n 2;n p c 25 [test 16:]pc 42 _1:o 26 [test 17:]pc _1;p 27 [test 18:]pc 100 0:q 1 Sq 0;q p Lq p 0;q p c 28 [test 19:]pc 10 0:r 1 Sr 20 0:r 2 Sr 30 0:r 0;r p Lr p 0;r p Lr p 0;r p c 29 [test 20:]pc 5 0:s 1 Ss 2 Ss Ls p 0;s p Ls p 0;s p c 30 [test 21:]pc 42 0:t 99 st 0;t p lt p c 31 [test 22:]pc 1 0:u 2 1:u 99 Su 50 0:u 0;u p Lu p 0;u p 1;u p c 32 [test 23:]pc 10 0:v 20 1:v 1 Sv 2 Sv Lv p Lv p 0;v p 1;v p c 33 [test 24:]pc 100 5:w 1 Sw 200 5:w 2 Sw 300 5:w 5;w p Lw p 5;w p Lw p 5;w p c 34 EOF 35 36 diff -u - $tmp <<'EOF' 37 ../dc: array index must fit in a positive integer 38 ../dc: array index must fit in a positive integer 39 test 1: 40 42 41 test 2: 42 10 43 20 44 30 45 test 3: 46 100 47 test 4: 48 -42 49 test 5: 50 1.5 51 test 6: 52 99999999999999999999 53 test 7: 54 hello 55 test 8: 56 2 57 test 9: 58 5 59 test 10: 60 6 61 test 11: 62 10000 63 test 12: 64 21 65 test 13: 66 3 67 test 14: 68 25 69 test 15: 70 50 71 test 16: 72 test 17: 73 test 18: 74 0 75 1 76 100 77 test 19: 78 30 79 2 80 20 81 1 82 10 83 test 20: 84 2 85 0 86 1 87 5 88 test 21: 89 42 90 99 91 test 22: 92 50 93 99 94 1 95 2 96 test 23: 97 2 98 1 99 10 100 20 101 test 24: 102 300 103 2 104 200 105 1 106 100 107 EOF