13 my $ok = $_[0] eq $_[1];;
14 print "not " unless $ok;
16 print " # $_[2]" if !$ok && @_ == 3;
20 sub skip { print "ok ", $test++, " # Skip: $_[0]\n" }
24 print "ok $test\n"; ++$test;
26 # printing characters should work
27 if (ord("\t") == 9) { # ASCII
30 print "$test\n"; ++$test;
34 print "$h{ok} $test\n"; ++$test;
39 print "$test\n"; ++$test;
43 print "$h{ok} $test\n"; ++$test;
46 # poetry optimization should also
49 print "$x $test\n"; ++$test;
51 # but not when dots are involved
52 if (ord("\t") == 9) { # ASCII
60 okeq(v1.20.300.4000, "\x{1}\x{14}\x{12c}\x{fa0}");
63 # now do the same without the "v"
66 print "ok $test\n"; ++$test;
69 if (ord("\t") == 9) { # ASCII
70 $h{111.107.32} = "ok";
73 $h{150.146.64} = "ok";
75 print "$h{ok } $test\n"; ++$test;
77 if (ord("\t") == 9) { # ASCII
85 okeq(1.20.300.4000, "\x{1}\x{14}\x{12c}\x{fa0}");
87 # test sprintf("%vd"...) etc
88 if (ord("\t") == 9) { # ASCII
89 okeq(sprintf("%vd", "Perl"), '80.101.114.108');
92 okeq(sprintf("%vd", "Perl"), '215.133.153.147');
95 okeq(sprintf("%vd", v1.22.333.4444), '1.22.333.4444');
97 if (ord("\t") == 9) { # ASCII
98 okeq(sprintf("%vx", "Perl"), '50.65.72.6c');
101 okeq(sprintf("%vx", "Perl"), 'd7.85.99.93');
104 okeq(sprintf("%vX", 1.22.333.4444), '1.16.14D.115C');
106 if (ord("\t") == 9) { # ASCII
107 okeq(sprintf("%#*vo", ":", "Perl"), '0120:0145:0162:0154');
110 okeq(sprintf("%#*vo", ":", "Perl"), '0327:0205:0231:0223');
113 okeq(sprintf("%*vb", "##", v1.22.333.4444),
114 '1##10110##101001101##1000101011100');
116 okeq(sprintf("%vd", join("", map { chr }
117 unpack 'U*', pack('U*',2001,2002,2003))),
123 if (ord("\t") == 9) { # ASCII
124 okeq(sprintf("%vd", "Perl"), '80.101.114.108');
127 okeq(sprintf("%vd", "Perl"), '215.133.153.147');
130 if (ord("\t") == 9) { # ASCII
131 okeq(sprintf("%vd", 1.22.333.4444), '1.22.197.141.225.133.156');
134 okeq(sprintf("%vd", 1.22.333.4444), '1.22.142.84.187.81.112');
137 if (ord("\t") == 9) { # ASCII
138 okeq(sprintf("%vx", "Perl"), '50.65.72.6c');
141 okeq(sprintf("%vx", "Perl"), 'd7.85.99.93');
144 if (ord("\t") == 9) { # ASCII
145 okeq(sprintf("%vX", v1.22.333.4444), '1.16.C5.8D.E1.85.9C');
148 okeq(sprintf("%vX", v1.22.333.4444), '1.16.8E.54.BB.51.70');
151 if (ord("\t") == 9) { # ASCII
152 okeq(sprintf("%#*vo", ":", "Perl"), '0120:0145:0162:0154');
155 okeq(sprintf("%#*vo", ":", "Perl"), '0327:0205:0231:0223');
158 if (ord("\t") == 9) { # ASCII
159 okeq(sprintf("%*vb", "##", v1.22.333.4444),
160 '1##10110##11000101##10001101##11100001##10000101##10011100');
163 okeq(sprintf("%*vb", "##", v1.22.333.4444),
164 '1##10110##10001110##1010100##10111011##1010001##1110000');
171 # bug id 20000323.056
173 print "not " unless "\x{41}" eq +v65;
177 print "not " unless "\x41" eq +v65;
181 print "not " unless "\x{c8}" eq +v200;
185 print "not " unless "\xc8" eq +v200;
189 print "not " unless "\x{221b}" eq v8731;
194 # See if the things Camel-III says are true: 29..33
197 my $vs = v1.20.300.4000;
198 okeq($vs,"\x{1}\x{14}\x{12c}\x{fa0}","v-string ne \\x{}");
199 okeq($vs,chr(1).chr(20).chr(300).chr(4000),"v-string ne chr()");
200 okeq('foo',((chr(193) eq 'A') ? v134.150.150 : v102.111.111),"v-string ne ''");
204 # See if sane addr and gethostbyaddr() work
205 eval { require Socket; gethostbyaddr(v127.0.0.1, Socket::AF_INET) };
208 # No - so don't test insane fails.
210 skip("No Socket::AF_INET # $@");
214 my $ip = v2004.148.0.1;
216 eval { $host = gethostbyaddr($ip,Socket::AF_INET) };
217 okeq($@ =~ /Wide character/,1,"Non-bytes leak to gethostbyaddr");
221 okeq(v5.6.0 lt v5.7.0,1,"v5.6.0 lt v5.7.0 fails");
223 # floating point too messy
224 # my $v = ord($^V)+ord(substr($^V,1,1))/1000+ord(substr($^V,2,1))/1000000;
225 # okeq($v,$],"\$^V and \$] do not match");
227 # 34..37: part of 20000323.059
228 print "not " unless v200 eq chr(200);
231 print "not " unless v200 eq +v200;
234 print "not " unless v200 eq eval "v200";
237 print "not " unless v200 eq eval "+v200";