Commit | Line | Data |
8d063cd8 |
1 | #!./perl |
2 | |
93312bbf |
3 | print "1..50\n"; |
252aa082 |
4 | |
b21ed0a9 |
5 | print +(oct('0b1_0101') == 0b101_01) ? "ok" : "not ok", " 1\n"; |
6 | print +(oct('0b10_101') == 0_2_5) ? "ok" : "not ok", " 2\n"; |
7 | print +(oct('0b101_01') == 2_1) ? "ok" : "not ok", " 3\n"; |
8 | print +(oct('0b1010_1') == 0x1_5) ? "ok" : "not ok", " 4\n"; |
252aa082 |
9 | |
b21ed0a9 |
10 | print +(oct('b1_0101') == 0b10101) ? "ok" : "not ok", " 5\n"; |
11 | print +(oct('b10_101') == 025) ? "ok" : "not ok", " 6\n"; |
12 | print +(oct('b101_01') == 21) ? "ok" : "not ok", " 7\n"; |
13 | print +(oct('b1010_1') == 0x15) ? "ok" : "not ok", " 8\n"; |
252aa082 |
14 | |
b21ed0a9 |
15 | print +(oct('01_234') == 0b10_1001_1100) ? "ok" : "not ok", " 9\n"; |
16 | print +(oct('012_34') == 01234) ? "ok" : "not ok", " 10\n"; |
17 | print +(oct('0123_4') == 668) ? "ok" : "not ok", " 11\n"; |
252aa082 |
18 | print +(oct('01234') == 0x29c) ? "ok" : "not ok", " 12\n"; |
19 | |
b21ed0a9 |
20 | print +(oct('0x1_234') == 0b10010_00110100) ? "ok" : "not ok", " 13\n"; |
21 | print +(oct('0x12_34') == 01_1064) ? "ok" : "not ok", " 14\n"; |
22 | print +(oct('0x123_4') == 4660) ? "ok" : "not ok", " 15\n"; |
23 | print +(oct('0x1234') == 0x12_34) ? "ok" : "not ok", " 16\n"; |
252aa082 |
24 | |
b21ed0a9 |
25 | print +(oct('x1_234') == 0b100100011010_0) ? "ok" : "not ok", " 17\n"; |
26 | print +(oct('x12_34') == 0_11064) ? "ok" : "not ok", " 18\n"; |
27 | print +(oct('x123_4') == 4660) ? "ok" : "not ok", " 19\n"; |
28 | print +(oct('x1234') == 0x_1234) ? "ok" : "not ok", " 20\n"; |
9e24b6e2 |
29 | |
b21ed0a9 |
30 | print +(hex('01_234') == 0b_1001000110100) ? "ok" : "not ok", " 21\n"; |
31 | print +(hex('012_34') == 011064) ? "ok" : "not ok", " 22\n"; |
32 | print +(hex('0123_4') == 4660) ? "ok" : "not ok", " 23\n"; |
33 | print +(hex('01234_') == 0x1234) ? "ok" : "not ok", " 24\n"; |
9e24b6e2 |
34 | |
b21ed0a9 |
35 | print +(hex('0x_1234') == 0b1001000110100) ? "ok" : "not ok", " 25\n"; |
36 | print +(hex('0x1_234') == 011064) ? "ok" : "not ok", " 26\n"; |
37 | print +(hex('0x12_34') == 4660) ? "ok" : "not ok", " 27\n"; |
38 | print +(hex('0x1234_') == 0x1234) ? "ok" : "not ok", " 28\n"; |
9e24b6e2 |
39 | |
b21ed0a9 |
40 | print +(hex('x_1234') == 0b1001000110100) ? "ok" : "not ok", " 29\n"; |
41 | print +(hex('x12_34') == 011064) ? "ok" : "not ok", " 30\n"; |
42 | print +(hex('x123_4') == 4660) ? "ok" : "not ok", " 31\n"; |
43 | print +(hex('x1234_') == 0x1234) ? "ok" : "not ok", " 32\n"; |
ba2b8430 |
44 | |
b21ed0a9 |
45 | print +(oct('0b1111_1111_1111_1111_1111_1111_1111_1111') == 4294967295) ? |
ba2b8430 |
46 | "ok" : "not ok", " 33\n"; |
b21ed0a9 |
47 | print +(oct('037_777_777_777') == 4294967295) ? |
ba2b8430 |
48 | "ok" : "not ok", " 34\n"; |
b21ed0a9 |
49 | print +(oct('0xffff_ffff') == 4294967295) ? |
ba2b8430 |
50 | "ok" : "not ok", " 35\n"; |
893fe2c2 |
51 | |
b21ed0a9 |
52 | print +(hex('0xff_ff_ff_ff') == 4294967295) ? |
893fe2c2 |
53 | "ok" : "not ok", " 36\n"; |
b21ed0a9 |
54 | |
55 | $_ = "\0_7_7"; |
56 | print length eq 5 ? "ok" : "not ok", " 37\n"; |
57 | print $_ eq "\0"."_"."7"."_"."7" ? "ok" : "not ok", " 38\n"; |
58 | chop, chop, chop, chop; |
59 | print $_ eq "\0" ? "ok" : "not ok", " 39\n"; |
2f2d036a |
60 | if (ord("\t") != 9) { |
61 | # question mark is 111 in 1047, 037, && POSIX-BC |
62 | print "\157_" eq "?_" ? "ok" : "not ok", " 40\n"; |
63 | } |
64 | else { |
65 | print "\077_" eq "?_" ? "ok" : "not ok", " 40\n"; |
66 | } |
b21ed0a9 |
67 | |
68 | $_ = "\x_7_7"; |
69 | print length eq 5 ? "ok" : "not ok", " 41\n"; |
70 | print $_ eq "\0"."_"."7"."_"."7" ? "ok" : "not ok", " 42\n"; |
71 | chop, chop, chop, chop; |
72 | print $_ eq "\0" ? "ok" : "not ok", " 43\n"; |
2f2d036a |
73 | if (ord("\t") != 9) { |
74 | # / is 97 in 1047, 037, && POSIX-BC |
75 | print "\x61_" eq "/_" ? "ok" : "not ok", " 44\n"; |
76 | } |
77 | else { |
78 | print "\x2F_" eq "/_" ? "ok" : "not ok", " 44\n"; |
79 | } |
93312bbf |
80 | |
81 | print +(oct('0b'.( '0'x10).'1_0101') == 0b101_01) ? "ok" : "not ok", " 45\n"; |
82 | print +(oct('0b'.( '0'x100).'1_0101') == 0b101_01) ? "ok" : "not ok", " 46\n"; |
83 | print +(oct('0b'.('0'x1000).'1_0101') == 0b101_01) ? "ok" : "not ok", " 47\n"; |
84 | |
85 | print +(hex(( '0'x10).'01234') == 0x1234) ? "ok" : "not ok", " 48\n"; |
86 | print +(hex(( '0'x100).'01234') == 0x1234) ? "ok" : "not ok", " 49\n"; |
87 | print +(hex(('0'x1000).'01234') == 0x1234) ? "ok" : "not ok", " 50\n"; |
88 | |