This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
additional docs and tests
[perl5.git] / t / op / lc.t
1 #!./perl
2
3 print "1..40\n";
4
5 $a = "HELLO.* world";
6 $b = "hello.* WORLD";
7
8 print "ok 1\n"  if "\Q$a\E."      eq "HELLO\\.\\*\\ world.";
9 print "ok 2\n"  if "\u$a"         eq "HELLO\.\* world";
10 print "ok 3\n"  if "\l$a"         eq "hELLO\.\* world";
11 print "ok 4\n"  if "\U$a"         eq "HELLO\.\* WORLD";
12 print "ok 5\n"  if "\L$a"         eq "hello\.\* world";
13
14 print "ok 6\n"  if quotemeta($a)  eq "HELLO\\.\\*\\ world";
15 print "ok 7\n"  if ucfirst($a)    eq "HELLO\.\* world";
16 print "ok 8\n"  if lcfirst($a)    eq "hELLO\.\* world";
17 print "ok 9\n"  if uc($a)         eq "HELLO\.\* WORLD";
18 print "ok 10\n" if lc($a)         eq "hello\.\* world";
19
20 print "ok 11\n"  if "\Q$b\E."     eq "hello\\.\\*\\ WORLD.";
21 print "ok 12\n"  if "\u$b"        eq "Hello\.\* WORLD";
22 print "ok 13\n"  if "\l$b"        eq "hello\.\* WORLD";
23 print "ok 14\n"  if "\U$b"        eq "HELLO\.\* WORLD";
24 print "ok 15\n"  if "\L$b"        eq "hello\.\* world";
25
26 print "ok 16\n"  if quotemeta($b) eq "hello\\.\\*\\ WORLD";
27 print "ok 17\n"  if ucfirst($b)   eq "Hello\.\* WORLD";
28 print "ok 18\n"  if lcfirst($b)   eq "hello\.\* WORLD";
29 print "ok 19\n"  if uc($b)        eq "HELLO\.\* WORLD";
30 print "ok 20\n"  if lc($b)        eq "hello\.\* world";
31
32 $a = "\x{100}\x{101}\x{41}\x{61}";
33 $b = "\x{101}\x{100}\x{61}\x{41}";
34
35 print "ok 21\n" if "\Q$a\E."      eq "\x{100}\x{101}\x{41}\x{61}.";
36 print "ok 22\n" if "\u$a"         eq "\x{100}\x{101}\x{41}\x{61}";
37 print "ok 23\n" if "\l$a"         eq "\x{101}\x{101}\x{41}\x{61}";
38 print "ok 24\n" if "\U$a"         eq "\x{100}\x{100}\x{41}\x{41}";
39 print "ok 25\n" if "\L$a"         eq "\x{101}\x{101}\x{61}\x{61}";
40
41 print "ok 26\n" if quotemeta($a)  eq "\x{100}\x{101}\x{41}\x{61}";
42 print "ok 27\n" if ucfirst($a)    eq "\x{100}\x{101}\x{41}\x{61}";
43 print "ok 28\n" if lcfirst($a)    eq "\x{101}\x{101}\x{41}\x{61}";
44 print "ok 29\n" if uc($a)         eq "\x{100}\x{100}\x{41}\x{41}";
45 print "ok 30\n" if lc($a)         eq "\x{101}\x{101}\x{61}\x{61}";
46
47 print "ok 31\n" if "\Q$b\E."      eq "\x{101}\x{100}\x{61}\x{41}.";
48 print "ok 32\n" if "\u$b"         eq "\x{100}\x{100}\x{61}\x{41}";
49 print "ok 33\n" if "\l$b"         eq "\x{101}\x{100}\x{61}\x{41}";
50 print "ok 34\n" if "\U$b"         eq "\x{100}\x{100}\x{41}\x{41}";
51 print "ok 35\n" if "\L$b"         eq "\x{101}\x{101}\x{61}\x{61}";
52
53 print "ok 36\n"  if quotemeta($b) eq "\x{101}\x{100}\x{61}\x{41}";
54 print "ok 37\n"  if ucfirst($b)   eq "\x{100}\x{100}\x{61}\x{41}";
55 print "ok 38\n"  if lcfirst($b)   eq "\x{101}\x{100}\x{61}\x{41}";
56 print "ok 39\n"  if uc($b)        eq "\x{100}\x{100}\x{41}\x{41}";
57 print "ok 40\n"  if lc($b)        eq "\x{101}\x{101}\x{61}\x{61}";
58
59