[perl #73560] [PATCH] Fix typos in Pod::Functions
[p5sagit/p5-mst-13.2.git] / lib / bigintpl.t
CommitLineData
57ebbfd0 1#!./perl
8990e307 2
88587957 3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
96471c6b 7
8{
9 # Silence the deprecation warnings from bigint.pl for the purpose
10 # of testing. These tests will be removed along with bigint.pl in
11 # the next major release of perl.
12 local $SIG{__WARN__} = sub {
13 if ($_[0] !~ /deprecated/) {
14 print(STDERR @_);
15 }
16 };
17 require "bigint.pl";
18}
57ebbfd0 19
20$test = 0;
21$| = 1;
22print "1..246\n";
23while (<DATA>) {
24 chop;
25 if (/^&/) {
26 $f = $_;
27 } else {
28 ++$test;
29 @args = split(/:/,$_,99);
30 $ans = pop(@args);
31 $try = "$f('" . join("','", @args) . "');";
32 if (($ans1 = eval($try)) eq $ans) {
33 print "ok $test\n";
34 } else {
35 print "not ok $test\n";
36 print "# '$try' expected: '$ans' got: '$ans1'\n";
37 }
38 }
39}
40__END__
41&bnorm
42abc:NaN
43 1 a:NaN
441bcd2:NaN
4511111b:NaN
46+1z:NaN
47-1z:NaN
480:+0
49+0:+0
50+00:+0
51+0 0 0:+0
52000000 0000000 00000:+0
53-0:+0
54-0000:+0
55+1:+1
56+01:+1
57+001:+1
58+00000100000:+100000
59123456789:+123456789
60-1:-1
61-01:-1
62-001:-1
63-123456789:-123456789
64-00000100000:-100000
65&bneg
66abd:NaN
67+0:+0
68+1:-1
69-1:+1
70+123456789:-123456789
71-123456789:+123456789
72&babs
73abc:NaN
74+0:+0
75+1:+1
76-1:+1
77+123456789:+123456789
78-123456789:+123456789
79&bcmp
80abc:abc:
81abc:+0:
82+0:abc:
83+0:+0:0
84-1:+0:-1
85+0:-1:1
86+1:+0:1
87+0:+1:-1
88-1:+1:-1
89+1:-1:1
90-1:-1:0
91+1:+1:0
92+123:+123:0
93+123:+12:1
94+12:+123:-1
95-123:-123:0
96-123:-12:-1
97-12:-123:1
98+123:+124:-1
99+124:+123:1
100-123:-124:1
101-124:-123:-1
102&badd
103abc:abc:NaN
104abc:+0:NaN
105+0:abc:NaN
106+0:+0:+0
107+1:+0:+1
108+0:+1:+1
109+1:+1:+2
110-1:+0:-1
111+0:-1:-1
112-1:-1:-2
113-1:+1:+0
114+1:-1:+0
115+9:+1:+10
116+99:+1:+100
117+999:+1:+1000
118+9999:+1:+10000
119+99999:+1:+100000
120+999999:+1:+1000000
121+9999999:+1:+10000000
122+99999999:+1:+100000000
123+999999999:+1:+1000000000
124+9999999999:+1:+10000000000
125+99999999999:+1:+100000000000
126+10:-1:+9
127+100:-1:+99
128+1000:-1:+999
129+10000:-1:+9999
130+100000:-1:+99999
131+1000000:-1:+999999
132+10000000:-1:+9999999
133+100000000:-1:+99999999
134+1000000000:-1:+999999999
135+10000000000:-1:+9999999999
136+123456789:+987654321:+1111111110
137-123456789:+987654321:+864197532
138-123456789:-987654321:-1111111110
139+123456789:-987654321:-864197532
140&bsub
141abc:abc:NaN
142abc:+0:NaN
143+0:abc:NaN
144+0:+0:+0
145+1:+0:+1
146+0:+1:-1
147+1:+1:+0
148-1:+0:-1
149+0:-1:+1
150-1:-1:+0
151-1:+1:-2
152+1:-1:+2
153+9:+1:+8
154+99:+1:+98
155+999:+1:+998
156+9999:+1:+9998
157+99999:+1:+99998
158+999999:+1:+999998
159+9999999:+1:+9999998
160+99999999:+1:+99999998
161+999999999:+1:+999999998
162+9999999999:+1:+9999999998
163+99999999999:+1:+99999999998
164+10:-1:+11
165+100:-1:+101
166+1000:-1:+1001
167+10000:-1:+10001
168+100000:-1:+100001
169+1000000:-1:+1000001
170+10000000:-1:+10000001
171+100000000:-1:+100000001
172+1000000000:-1:+1000000001
173+10000000000:-1:+10000000001
174+123456789:+987654321:-864197532
175-123456789:+987654321:-1111111110
176-123456789:-987654321:+864197532
177+123456789:-987654321:+1111111110
178&bmul
179abc:abc:NaN
180abc:+0:NaN
181+0:abc:NaN
182+0:+0:+0
183+0:+1:+0
184+1:+0:+0
185+0:-1:+0
186-1:+0:+0
187+123456789123456789:+0:+0
188+0:+123456789123456789:+0
189-1:-1:+1
190-1:+1:-1
191+1:-1:-1
192+1:+1:+1
193+2:+3:+6
194-2:+3:-6
195+2:-3:-6
196-2:-3:+6
197+111:+111:+12321
198+10101:+10101:+102030201
199+1001001:+1001001:+1002003002001
200+100010001:+100010001:+10002000300020001
201+10000100001:+10000100001:+100002000030000200001
202+11111111111:+9:+99999999999
203+22222222222:+9:+199999999998
204+33333333333:+9:+299999999997
205+44444444444:+9:+399999999996
206+55555555555:+9:+499999999995
207+66666666666:+9:+599999999994
208+77777777777:+9:+699999999993
209+88888888888:+9:+799999999992
210+99999999999:+9:+899999999991
211&bdiv
212abc:abc:NaN
213abc:+1:abc:NaN
214+1:abc:NaN
215+0:+0:NaN
216+0:+1:+0
217+1:+0:NaN
218+0:-1:+0
219-1:+0:NaN
220+1:+1:+1
221-1:-1:+1
222+1:-1:-1
223-1:+1:-1
224+1:+2:+0
225+2:+1:+2
226+1000000000:+9:+111111111
227+2000000000:+9:+222222222
228+3000000000:+9:+333333333
229+4000000000:+9:+444444444
230+5000000000:+9:+555555555
231+6000000000:+9:+666666666
232+7000000000:+9:+777777777
233+8000000000:+9:+888888888
234+9000000000:+9:+1000000000
235+35500000:+113:+314159
236+71000000:+226:+314159
237+106500000:+339:+314159
238+1000000000:+3:+333333333
239+10:+5:+2
240+100:+4:+25
241+1000:+8:+125
242+10000:+16:+625
243+999999999999:+9:+111111111111
244+999999999999:+99:+10101010101
245+999999999999:+999:+1001001001
246+999999999999:+9999:+100010001
247+999999999999999:+99999:+10000100001
248&bmod
249abc:abc:NaN
250abc:+1:abc:NaN
251+1:abc:NaN
252+0:+0:NaN
253+0:+1:+0
254+1:+0:NaN
255+0:-1:+0
256-1:+0:NaN
257+1:+1:+0
258-1:-1:+0
259+1:-1:+0
260-1:+1:+0
261+1:+2:+1
262+2:+1:+0
263+1000000000:+9:+1
264+2000000000:+9:+2
265+3000000000:+9:+3
266+4000000000:+9:+4
267+5000000000:+9:+5
268+6000000000:+9:+6
269+7000000000:+9:+7
270+8000000000:+9:+8
271+9000000000:+9:+0
272+35500000:+113:+33
273+71000000:+226:+66
274+106500000:+339:+99
275+1000000000:+3:+1
276+10:+5:+0
277+100:+4:+0
278+1000:+8:+0
279+10000:+16:+0
280+999999999999:+9:+0
281+999999999999:+99:+0
282+999999999999:+999:+0
283+999999999999:+9999:+0
284+999999999999999:+99999:+0
285&bgcd
286abc:abc:NaN
287abc:+0:NaN
288+0:abc:NaN
289+0:+0:+0
290+0:+1:+1
291+1:+0:+1
292+1:+1:+1
293+2:+3:+1
294+3:+2:+1
295+100:+625:+25
296+4096:+81:+1