| 1 | # -*- mode: perl; -*- |
| 2 | |
| 3 | use strictscip-perl cpan Math-BigInt 2.005003 strict/; |
| 4 | use warningsscip-perl cpan Math-BigInt 2.005003 warnings/; |
| 5 | |
| 6 | use Test::Morescip-perl cpan Math-BigInt 2.005003 Test/More/ tests => 18; |
| 7 | |
| 8 | use Math::BigIntscip-perl cpan Math-BigInt 2.005003 Math/BigInt/; |
| 9 | |
| 10 | while (<DATA>) { |
| 11 | s/#.*$//; # remove comments |
| 12 | s/\s+$//; # remove trailing whitespace |
| 13 | next unless lengthscip-perl cpan Math-BigInt 2.005003 main/length().; # skip empty lines |
| 14 | |
| 15 | my ($in0, $out0, $out1, $out2, $out3) = splitscip-perl cpan Math-BigInt 2.005003 main/split(). /:/; |
| 16 | my ($ss, $sa, $es, $ea); |
| 17 | |
| 18 | my $test = q|($ss, $sa, $es, $ea) = | |
| 19 | . qq|Math::BigInt -> _oct_str_to_oct_str_parts("$in0")|; |
| 20 | |
| 21 | eval $test; |
| 22 | diescip-perl cpan Math-BigInt 2.005003 main/die(). $@scip-perl cpan Math-BigInt 2.005003 main/`$@`. if $@scip-perl cpan Math-BigInt 2.005003 main/`$@`.; # this should never happen |
| 23 | |
| 24 | subtestscip-perl cpan Math-BigInt 2.005003 main/subtest(). $test => sub { |
| 25 | planscip-perl cpan Math-BigInt 2.005003 main/plan(). tests => 4; |
| 26 | isscip-perl cpan Math-BigInt 2.005003 main/is().($ss, $out0, 'sign of the significand'); |
| 27 | isscip-perl cpan Math-BigInt 2.005003 main/is().($sa, $out1, 'absolute value of the significand'); |
| 28 | isscip-perl cpan Math-BigInt 2.005003 main/is().($es, $out2, 'sign of the exponent'); |
| 29 | isscip-perl cpan Math-BigInt 2.005003 main/is().($ea, $out3, 'absolute value of the exponent'); |
| 30 | }; |
| 31 | } |
| 32 | |
| 33 | __DATA__ |
| 34 | |
| 35 | 0:+:0:+:0 |
| 36 | 0p-0:+:0:+:0 |
| 37 | 0p-7:+:0:+:0 |
| 38 | 0p+7:+:0:+:0 |
| 39 | |
| 40 | 0.0120:+:.012:+:0 |
| 41 | 0120.0:+:120:+:0 |
| 42 | 0120.0340:+:120.034:+:0 |
| 43 | |
| 44 | 01.p0:+:1:+:0 |
| 45 | |
| 46 | 00.0012003400P0056007800:+:.00120034:+:56007800 |
| 47 | |
| 48 | +0__1__2__.__3__4__p+5__6__:+:12.34:+:56 |
| 49 | +0__1__2__.__3__4__p-5__6__:+:12.34:-:56 |
| 50 | -0__1__2__.__3__4__p+5__6__:-:12.34:+:56 |
| 51 | -0__1__2__.__3__4__p-5__6__:-:12.34:-:56 |
| 52 | |
| 53 | 01__2__.__3__4__p5__6__:+:12.34:+:56 |
| 54 | 1__2__.__3__4__p-5__6__:+:12.34:-:56 |
| 55 | -1__2__.__3__4__p5__6__:-:12.34:+:56 |
| 56 | |
| 57 | -0o__1__2__.__3__4__p-5__6__:-:12.34:-:56 |
| 58 | -0O__1__2__.__3__4__P-5__6__:-:12.34:-:56 |