[patch: perl@8211]VMS: add -Duseperlio capacity to configure.com
[p5sagit/p5-mst-13.2.git] / t / op / length.t
CommitLineData
9dc04555 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6}
7
8print "1..13\n";
9
10print "not " unless length("") == 0;
11print "ok 1\n";
12
13print "not " unless length("abc") == 3;
14print "ok 2\n";
15
16$_ = "foobar";
17print "not " unless length() == 6;
18print "ok 3\n";
19
20# Okay, so that wasn't very challenging. Let's go Unicode.
21
22{
23 my $a = "\x{41}";
24
25 print "not " unless length($a) == 1;
26 print "ok 4\n";
27 $test++;
28
29 use bytes;
30 print "not " unless $a eq "\x41" && length($a) == 1;
31 print "ok 5\n";
32 $test++;
33}
34
35{
36 my $a = "\x{80}";
37
38 print "not " unless length($a) == 1;
39 print "ok 6\n";
40 $test++;
41
42 use bytes;
43 print "not " unless $a eq "\xc2\x80" && length($a) == 2;
44 print "ok 7\n";
45 $test++;
46}
47
48{
49 my $a = "\x{100}";
50
51 print "not " unless length($a) == 1;
52 print "ok 8\n";
53 $test++;
54
55 use bytes;
56 print "not " unless $a eq "\xc4\x80" && length($a) == 2;
57 print "ok 9\n";
58 $test++;
59}
60
61{
62 my $a = "\x{100}\x{80}";
63
64 print "not " unless length($a) == 2;
65 print "ok 10\n";
66 $test++;
67
68 use bytes;
69 print "not " unless $a eq "\xc4\x80\xc2\x80" && length($a) == 4;
70 print "ok 11\n";
71 $test++;
72}
73
74{
75 my $a = "\x{80}\x{100}";
76
77 print "not " unless length($a) == 2;
78 print "ok 12\n";
79 $test++;
80
81 use bytes;
82 print "not " unless $a eq "\xc2\x80\xc4\x80" && length($a) == 4;
83 print "ok 13\n";
84 $test++;
85}