Fix for a crash which happened when a document couldn't be opened.
[AROS-Contrib.git] / regina / trip / lostdigits.rexx
blob5574e2fdf4c64b670007eaa5455ca9178e34e058
1 /*
2 * This is a simple test program for all the different occurances of possible
3 * LOSTDIGITS conditions of Regina.
5 * Every error message is writen to standard error.
6 * One line is written to standard output on success.
8 * Return codes: 0 on success, 1 otherwise
9 */
10 errors = 0
11 written = 0
13 call notify 'digits 5'
14 numeric digits 5
15 call doTest
16 call notify 'digits 4'
17 numeric digits 4
18 call doTest
19 if errors = 0 then do
20 exit 0
21 end
22 exit 1
24 doTest:
25 signal on lostdigits name addlost
26 b = 10001 + 1
27 adddone:
28 if digits() <= 4 then
29 call error "LOSTDIGITS not raised in addition, but needs to"
30 signal addend
32 addlost:
33 if digits() > 4 then
34 call error "LOSTDIGITS raised in addition, but must not"
36 addend:
37 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
39 signal on lostdigits name sublost
40 b = -10001 - 1
41 subdone:
42 if digits() <= 4 then
43 call error "LOSTDIGITS not raised in subtraction, but needs to"
44 signal subend
46 sublost:
47 if digits() > 4 then
48 call error "LOSTDIGITS raised in subtraction, but must not"
50 subend:
51 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
53 signal on lostdigits name mullost
54 b = 1.0001 * 2
55 muldone:
56 if digits() <= 4 then
57 call error "LOSTDIGITS not raised in multiplication, but needs to"
58 signal mulend
60 mullost:
61 if digits() > 4 then
62 call error "LOSTDIGITS raised in multiplication, but must not"
64 mulend:
65 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
67 signal on lostdigits name fdivlost
68 b = 1.0001 / 2
69 fdivdone:
70 if digits() <= 4 then
71 call error "LOSTDIGITS not raised in decimal division, but needs to"
72 signal fdivend
74 fdivlost:
75 if digits() > 4 then
76 call error "LOSTDIGITS raised in decimal division, but must not"
78 fdivend:
79 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
81 signal on lostdigits name idivlost
82 b = 1.0001 % 2
83 idivdone:
84 if digits() <= 4 then
85 call error "LOSTDIGITS not raised in integer division, but needs to"
86 signal idivend
88 idivlost:
89 if digits() > 4 then
90 call error "LOSTDIGITS raised in integer division, but must not"
92 idivend:
93 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
95 signal on lostdigits name powlost
96 b = 8.0001 ** -2
97 powdone:
98 if digits() <= 4 then
99 call error "LOSTDIGITS not raised in power expression, but needs to"
100 signal powend
102 powlost:
103 if digits() > 4 then
104 call error "LOSTDIGITS raised in power expression, but must not"
106 powend:
108 return
110 error:
111 call lineout "<stderr>", arg(1)
112 errors = errors + 1
113 return
115 notify:
116 parse arg word
117 written = written + length(word) + 2
118 if written>75 then do
119 written = length(word)
120 say ' '
122 call charout , word || ', '
123 return