This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate with Sarathy (5.005_58).
[perl5.git] / t / op / oct.t
CommitLineData
8d063cd8
LW
1#!./perl
2
252aa082
JH
3print "1..24\n";
4
5print +(oct('0b10101') == 0b10101) ? "ok" : "not ok", " 1\n";
6print +(oct('0b10101') == 025) ? "ok" : "not ok", " 2\n";
7print +(oct('0b10101') == 21) ? "ok" : "not ok", " 3\n";
8print +(oct('0b10101') == 0x15) ? "ok" : "not ok", " 4\n";
9
10print +(oct('b10101') == 0b10101) ? "ok" : "not ok", " 5\n";
11print +(oct('b10101') == 025) ? "ok" : "not ok", " 6\n";
12print +(oct('b10101') == 21) ? "ok" : "not ok", " 7\n";
13print +(oct('b10101') == 0x15) ? "ok" : "not ok", " 8\n";
14
15print +(oct('01234') == 0b1010011100) ? "ok" : "not ok", " 9\n";
16print +(oct('01234') == 01234) ? "ok" : "not ok", " 10\n";
17print +(oct('01234') == 668) ? "ok" : "not ok", " 11\n";
18print +(oct('01234') == 0x29c) ? "ok" : "not ok", " 12\n";
19
20print +(oct('0x1234') == 0b1001000110100) ? "ok" : "not ok", " 13\n";
21print +(oct('0x1234') == 011064) ? "ok" : "not ok", " 14\n";
22print +(oct('0x1234') == 4660) ? "ok" : "not ok", " 15\n";
23print +(oct('0x1234') == 0x1234) ? "ok" : "not ok", " 16\n";
24
25print +(hex('01234') == 0b1001000110100) ? "ok" : "not ok", " 17\n";
26print +(hex('01234') == 011064) ? "ok" : "not ok", " 18\n";
27print +(hex('01234') == 4660) ? "ok" : "not ok", " 19\n";
28print +(hex('01234') == 0x1234) ? "ok" : "not ok", " 20\n";
29
30print +(hex('0x1234') == 0b1001000110100) ? "ok" : "not ok", " 21\n";
31print +(hex('0x1234') == 011064) ? "ok" : "not ok", " 22\n";
32print +(hex('0x1234') == 4660) ? "ok" : "not ok", " 23\n";
33print +(hex('0x1234') == 0x1234) ? "ok" : "not ok", " 24\n";