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 -> _hex_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.0120:+:.012:+:0 410120.0:+:120:+:0 420120.0340:+:120.034:+:0 43 440x1.p0:+:1:+:0 45 4600.0012003400P0056007800:+:.00120034:+:56007800 47 48+1__2__.__3__4__p+5__6__:+:12.34:+:56 49+1__2__.__3__4__p-5__6__:+:12.34:-:56 50-1__2__.__3__4__p+5__6__:-:12.34:+:56 51-1__2__.__3__4__p-5__6__:-:12.34:-:56 52 531__2__.__3__4__p5__6__:+:12.34:+:56 541__2__.__3__4__p-5__6__:+:12.34:-:56 55-1__2__.__3__4__p5__6__:-:12.34:+:56 56 57-0x__a__b__.__c__d__p-1__2__:-:ab.cd:-:12 58-0X__A__B__.__C__D__P-1__2__:-:AB.CD:-:12 59