generalize "%v" format into a flag for any integral format type:
[p5sagit/p5-mst-13.2.git] / t / op / ver.t
CommitLineData
3cb0bbe5 1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 unshift @INC, "../lib";
6}
7
b22c7a20 8print "1..15\n";
3cb0bbe5 9
10my $test = 1;
11
12use v5.5.640;
13require v5.5.640;
14print "ok $test\n"; ++$test;
15
16print "not " unless v1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}";
17print "ok $test\n"; ++$test;
18
19print "not " unless v1.20.300.4000 > 1.0203039 and v1.20.300.4000 < 1.0203041;
20print "ok $test\n"; ++$test;
21
b22c7a20 22print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108';
3cb0bbe5 23print "ok $test\n"; ++$test;
24
b22c7a20 25print "not " unless sprintf("%vd", v1.22.333.4444) eq '1.22.333.4444';
26print "ok $test\n"; ++$test;
27
28print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c';
29print "ok $test\n"; ++$test;
30
31print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.14D.115C';
32print "ok $test\n"; ++$test;
33
34print "not " unless sprintf("%*v#o", ":", "Perl") eq '0120:0145:0162:0154';
35print "ok $test\n"; ++$test;
36
37print "not " unless sprintf("%*vb", "##", v1.22.333.4444)
38 eq '1##10110##101001101##1000101011100';
3cb0bbe5 39print "ok $test\n"; ++$test;
40
41{
8058d7ab 42 use bytes;
b22c7a20 43 print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108';
44 print "ok $test\n"; ++$test;
45
3cb0bbe5 46 print "not " unless
b22c7a20 47 sprintf("%vd", v1.22.333.4444) eq '1.22.197.141.225.133.156';
48 print "ok $test\n"; ++$test;
49
50 print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c';
51 print "ok $test\n"; ++$test;
52
53 print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.C5.8D.E1.85.9C';
54 print "ok $test\n"; ++$test;
55
56 print "not " unless sprintf("%*v#o", ":", "Perl") eq '0120:0145:0162:0154';
57 print "ok $test\n"; ++$test;
58
59 print "not " unless sprintf("%*vb", "##", v1.22.333.4444)
60 eq '1##10110##11000101##10001101##11100001##10000101##10011100';
3cb0bbe5 61 print "ok $test\n"; ++$test;
62}