1# -*- mode: perl; -*- 2 3use strict; 4use warnings; 5 6use Test::More tests => 18; 7 8use Math::BigInt; 9 10while (<DATA>) { 11 s/#.*$//; # remove comments 12 s/\s+$//; # remove trailing whitespace 13 next unless length; # skip empty lines 14 15 my ($in0, $out0, $out1, $out2, $out3) = split /:/; 16 my ($ss, $sa, $es, $ea); 17 18 my $test = q|($ss, $sa, $es, $ea) = | 19 . qq|Math::BigInt -> _bin_str_to_str_parts("$in0")|; 20 21 eval $test; 22 die $@ if $@; # this should never happen 23 24 subtest $test => sub { 25 plan tests => 4; 26 is($ss, $out0, 'sign of the significand'); 27 is($sa, $out1, 'absolute value of the significand'); 28 is($es, $out2, 'sign of the exponent'); 29 is($ea, $out3, 'absolute value of the exponent'); 30 }; 31} 32 33__DATA__ 34 350:+:0:+:0 360p-0:+:0:+:0 370p-7:+:0:+:0 380p+7:+:0:+:0 39 400.0110:+:.011:+:0 410110.0:+:110:+:0 420110.0110:+:110.011:+:0 43 440b1.p0:+:1:+:0 45 4600.0011001100P0056007800:+:.00110011:+:56007800 47 48+1__1__.__1__1__p+5__6__:+:11.11:+:56 49+1__1__.__1__1__p-5__6__:+:11.11:-:56 50-1__1__.__1__1__p+5__6__:-:11.11:+:56 51-1__1__.__1__1__p-5__6__:-:11.11:-:56 52 531__1__.__1__1__p5__6__:+:11.11:+:56 541__1__.__1__1__p-5__6__:+:11.11:-:56 55-1__1__.__1__1__p5__6__:-:11.11:+:56 56 57-0b__1__1__.__1__1__p-1__1__:-:11.11:-:11 58-0B__1__1__.__1__1__P-1__1__:-:11.11:-:11 59