6 use Test
::More tests
=> 70;
11 my %special = ( 9 => "\\t", 10 => "\\n", 13 => "\\r" );
15 defined $neat or return "undef";
16 my $ref = ref $neat ?
"\\" : "" and $neat = $$neat;
19 $cp >= 0x20 && $cp <= 0x7e
21 : $special{$cp} || sprintf "\\x{%02x}", $cp
26 [ undef, undef, undef, undef, undef, 0, undef ],
27 [ 0, undef, 0, undef, undef, 0, undef ],
28 [ 1, undef, 1, undef, undef, 0, undef ],
29 [ 0.5, undef, undef, 0.5, undef, 0, 0 ],
30 [ "", "", undef, undef, undef, 0, 0 ],
31 [ \
0, undef, undef, undef, 0, 0, undef ],
32 [ \"a
", undef, undef, undef, "a
", 0, undef ],
34 (undef, my @exp) = @$test;
35 my $in = neat ($test->[0]);
36 ok (my @v = DDual ($test->[0]), "DDual
($in)");
37 is (scalar @v, 5, "5 elements
");
38 is ($v[0], $exp[0], "PV
$in ".DPeek ($v[0]));
39 is ($v[1], $exp[1], "IV
$in ".DPeek ($v[1]));
40 is ($v[2], $exp[2], "NV
$in ".DPeek ($v[2]));
41 is ($v[3], $exp[3], "RV
$in ".DPeek ($v[3]));
42 is ($v[4], $exp[4], "MG
$in ".DPeek ($v[4]));
44 defined $v[1] and next;
46 my $x = 0 + $test->[0];
48 TODO: { local $TODO = "Do all perl versions upgrade?
";
49 ok (@v = DDual ($test->[0]), "DDual
($in + 0)");
50 is ($v[1], $exp[5], "IV
$in ".DPeek ($v[1]));
54 TODO: { local $TODO = "How magic is \
$? accross perl versions?
";
56 is ($m[4], 3, "\
$? has magic
");
57 is ($m[0], undef, "PV \
$? w
/o get
");
58 is ($m[1], undef, "IV \
$? w
/o get
");
59 is ($m[2], undef, "NV \
$? w
/o get
");
60 is ($m[3], undef, "RV \
$? w
/o get
");
63 TODO: { local $TODO = "How magic is \
$? accross perl versions?
";
64 my @m = DDual ($?, 1);
65 is ($m[4], 3, "\
$? has magic
");
66 is ($m[0], undef, "PV \
$? w
/ get
");
67 is ($m[1], 0, "IV \
$? w
/ get
");
68 is ($m[2], undef, "NV \
$? w
/ get
");
69 is ($m[3], undef, "RV \
$? w
/ get
");