oct.t revision 7c478bd95313f5f23a4c958a745db2134aa03244
#!./perl
# tests 51 onwards aren't all warnings clean. (intentionally)
print "1..71\n";
my $test = 1;
sub test ($$$) {
my $result;
} else {
}
} else {
}
} else {
} else {
}
}
$test++;
}
test ('oct', 'b10_101', 025);
test ('oct', 'b101_01', 21);
test ('oct', 'b1010_1', 0x15);
test ('oct', '012_34', 01234);
test ('oct', '0123_4', 668);
test ('oct', '01234', 0x29c);
test ('oct', '0x123_4', 4660);
test ('oct', 'x123_4', 4660);
test ('hex', '012_34', 011064);
test ('hex', '0123_4', 4660);
test ('hex', '01234_', 0x1234);
test ('hex', '0x1_234', 011064);
test ('hex', '0x12_34', 4660);
test ('hex', '0x1234_', 0x1234);
test ('hex', 'x12_34', 011064);
test ('hex', 'x123_4', 4660);
test ('hex', 'x1234_', 0x1234);
test ('oct', '0b1111_1111_1111_1111_1111_1111_1111_1111', 4294967295);
test ('oct', '037_777_777_777', 4294967295);
test ('oct', '0xffff_ffff', 4294967295);
test ('hex', '0xff_ff_ff_ff', 4294967295);
$_ = "\0_7_7";
# question mark is 111 in 1047, 037, && POSIX-BC
}
else {
}
$_ = "\x_7_7";
# / is 97 in 1047, 037, && POSIX-BC
}
else {
}
$test = 45;
# Things that perl 5.6.1 and 5.7.2 did wrong (plus some they got right)
test ('oct', "b00b0101", 0);
test ('oct', "bb0101", 0);
test ('oct', "0bb0101", 0);
test ('oct', "0x0x3A", 0);
test ('oct', "0xx3A", 0);
test ('oct', "x0x3A", 0);
test ('oct', "xx3A", 0);
test ('oct', "0x3A", 0x3A);
test ('oct', "x3A", 0x3A);
test ('oct', "0x0x4", 0);
test ('oct', "0xx4", 0);
test ('oct', "x0x4", 0);
test ('oct', "xx4", 0);
test ('oct', "0x4", 4);
test ('oct', "x4", 4);
test ('hex', "0x3A", 0x3A);
test ('hex', "x3A", 0x3A);
test ('hex', "0x4", 4);
test ('hex', "x4", 4);
eval '$a = oct "10\x{100}"';
eval '$a = hex "ab\x{100}"';