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; |
7 | plan test => 6; |
8 | # Error messages may have wide chars, say that is okay - if we can. |
9 | eval { binmode STDOUT,":utf8" }; |
10 | |
11 | # Chapter 2 pp67/68 |
12 | my $vs = v1.20.300.4000; |
13 | ok($vs,"\x{1}\x{14}\x{12c}\x{fa0}","v-string ne \\x{}"); |
14 | ok($vs,chr(1).chr(20).chr(300).chr(4000),"v-string ne chr()"); |
15 | ok('foo',v102.111.111,"v-string ne ''"); |
16 | |
17 | # Chapter 15, pp403 |
18 | |
19 | # See if sane addr and gethostbyaddr() work |
20 | eval { require Socket; gethostbyaddr(v127.0.0.1,Socket::AF_INET()) }; |
21 | if ($@) |
22 | { |
23 | # No - so don't test insane fails. |
24 | skip("No Socket",''); |
25 | } |
26 | else |
27 | { |
28 | my $ip = v2004.148.0.1; |
29 | my $host; |
30 | eval { $host = gethostbyaddr($ip,Socket::AF_INET()) }; |
31 | ok($@ =~ /Wide character/,1,"Non-bytes leak to gethostbyaddr"); |
32 | } |
33 | |
34 | # Chapter 28, pp671 |
35 | ok(v5.6.0 lt v5.7.0,1,"v5.6.0 lt v5.7.0 fails"); |
36 | # Some floating-point risk here ... |
37 | my $v = ord($^V)+ord(substr($^V,1,1))/1000+ord(substr($^V,2,1))/1000000; |
6d958cac |
38 | $v =~ s/^5\.006999\d+/5.007/; # floating point fun |
595ae481 |
39 | ok($v,$],"\$^V and \$] do not match"); |