Commit | Line | Data |
595ae481 |
1 | # See if the things Camel-III says are true. |
2 | BEGIN { |
3 | chdir 't' if -d 't'; |
4 | @INC = '../lib'; |
5 | } |
6 | use Test; |
b815e894 |
7 | plan test => 5; |
595ae481 |
8 | |
9 | # Chapter 2 pp67/68 |
10 | my $vs = v1.20.300.4000; |
11 | ok($vs,"\x{1}\x{14}\x{12c}\x{fa0}","v-string ne \\x{}"); |
12 | ok($vs,chr(1).chr(20).chr(300).chr(4000),"v-string ne chr()"); |
c4d5f83a |
13 | ok('foo',((chr(193) eq 'A') ? v134.150.150 : v102.111.111),"v-string ne ''"); |
595ae481 |
14 | |
15 | # Chapter 15, pp403 |
16 | |
17 | # See if sane addr and gethostbyaddr() work |
18 | eval { require Socket; gethostbyaddr(v127.0.0.1,Socket::AF_INET()) }; |
19 | if ($@) |
20 | { |
21 | # No - so don't test insane fails. |
22 | skip("No Socket",''); |
23 | } |
24 | else |
25 | { |
26 | my $ip = v2004.148.0.1; |
27 | my $host; |
28 | eval { $host = gethostbyaddr($ip,Socket::AF_INET()) }; |
29 | ok($@ =~ /Wide character/,1,"Non-bytes leak to gethostbyaddr"); |
30 | } |
31 | |
32 | # Chapter 28, pp671 |
33 | ok(v5.6.0 lt v5.7.0,1,"v5.6.0 lt v5.7.0 fails"); |
b815e894 |
34 | |
35 | # floating point too messy |
36 | # my $v = ord($^V)+ord(substr($^V,1,1))/1000+ord(substr($^V,2,1))/1000000; |
37 | # ok($v,$],"\$^V and \$] do not match"); |