16 is(ord($a), 0x100, "ord sanity check");
17 is(length($a), 1, "length sanity check");
18 is(substr($a, 0, 1), "\x{100}", "substr sanity check");
19 is(index($a, "\x{100}"), 0, "index sanity check");
20 is(rindex($a, "\x{100}"), 0, "rindex sanity check");
22 no warnings 'prototype'; # bytes::length() called too early to check prototype at...
23 is(bytes::length($a), 2, "bytes::length sanity check");
24 is(bytes::chr(0x100), chr(0), "bytes::chr sanity check");
29 my $b = chr(0x100); # affected by 'use bytes'
30 is(ord($b), 0, "chr truncates under use bytes");
31 is(length($b), 1, "length truncated under use bytes");
32 is(bytes::ord($b), 0, "bytes::ord truncated under use bytes");
33 is(bytes::length($b), 1, "bytes::length truncated under use bytes");
34 is(bytes::substr($b, 0, 1), "\0", "bytes::substr truncated under use bytes");
38 my $c2 = chr(0x2c7); # a unicode character that doesn't fold
39 utf8::encode(my $c2_utf8 = $c2);
43 if ($::IS_EBCDIC) { # EBCDIC?
44 is(ord($c), 0x8c, "ord under use bytes looks at the 1st byte");
46 is(ord($c), 0xc4, "ord under use bytes looks at the 1st byte");
48 is(length($c), 2, "length under use bytes looks at bytes");
49 is(bytes::length($c), 2, "bytes::length under use bytes looks at bytes");
50 if ($::IS_EBCDIC) { # EBCDIC?
51 is(bytes::ord($c), 0x8c, "bytes::ord under use bytes looks at the 1st byte");
53 is(bytes::ord($c), 0xc4, "bytes::ord under use bytes looks at the 1st byte");
55 # In z/OS \x41,\x8c are the codepoints corresponding to \x80,\xc4 respectively under ASCII platform
56 if ($::IS_EBCDIC) { # EBCDIC?
57 is(bytes::substr($c, 0, 1), "\x8c", "bytes::substr under use bytes looks at bytes");
58 is(bytes::index($c, "\x41"), 1, "bytes::index under use bytes looks at bytes");
59 is(bytes::rindex($c, "\x8c"), 0, "bytes::rindex under use bytes looks at bytes");
63 is(bytes::substr($c, 0, 1), "\xc4", "bytes::substr under use bytes looks at bytes");
64 is(bytes::index($c, "\x80"), 1, "bytes::index under use bytes looks at bytes");
65 is(bytes::rindex($c, "\xc4"), 0, "bytes::rindex under use bytes looks at bytes");
68 # [perl #117355] [lu]cfirst don't respect 'use bytes'
69 # and if there's other tests for lc/uc under bytes I didn't find them
70 is(lc($c2), $c2_utf8, "lc under use bytes returns bytes");
71 is(uc($c2), $c2_utf8, "uc under use bytes returns bytes");
72 is(lcfirst($c2), $c2_utf8, "lcfirst under use bytes returns bytes");
73 is(ucfirst($c2), $c2_utf8, "unfirst under use bytes returns bytes");
77 fresh_perl_like ('use bytes; bytes::moo()',
78 qr/Undefined subroutine bytes::moo/, {stderr=>1},
79 "Check Carp is loaded for AUTOLOADing errors")