diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-02 10:32:01 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-08-02 10:32:01 +0000 |
commit | 0f4b663008b5032408c35f3557d9d5c2790d3fcb (patch) | |
tree | 60ab7022a0c6f1632b74bf965475fcce8e70fe6b /t | |
parent | f0d0442576ea74c58911be43ef48f5977fe2e1fa (diff) | |
download | perl-0f4b663008b5032408c35f3557d9d5c2790d3fcb.tar.gz |
More 64-bit fixing. One known bug of that kind
remains, 32-bit platforms using long long in
the test t/pragma/utf8 subtests 1-3 fail.
(Update: change #3884 fixed that one.)
p4raw-link: @3884 (not found)
p4raw-id: //depot/cfgperl@3880
Diffstat (limited to 't')
-rw-r--r-- | t/op/64bit.t | 134 | ||||
-rwxr-xr-x | t/pragma/utf8.t | 16 |
2 files changed, 148 insertions, 2 deletions
diff --git a/t/op/64bit.t b/t/op/64bit.t new file mode 100644 index 0000000000..c8da1cbcdb --- /dev/null +++ b/t/op/64bit.t @@ -0,0 +1,134 @@ +BEGIN { + eval { pack "q", 0 }; + if ($@) { + print "1..0\n# no 64-bit types\n"; + exit(0); + } +} + +# This could use a lot of more tests. +# +# Nota bene: bit operations are not 64-bit clean. See the beginning +# of pp.c and the explanation next to IBW/UBW. + +print "1..27\n"; + +my $q = 12345678901; +my $r = 23456789012; +my $x; + + +$x = unpack "q", pack "q", $q; +print "not " unless $x == $q; +print "ok 1\n"; + + +$x = sprintf("%d", 12345678901); +print "not " unless $x eq "$q"; +print "ok 2\n"; + + +$x = sprintf("%d", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 3\n"; + +$x = sprintf("%lld", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 4\n"; + +$x = sprintf("%Ld", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 5\n"; + +$x = sprintf("%qd", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 6\n"; + + +$x = sprintf("%x", $q); +print "not " unless hex($x) == 0x2dfdc1c35; +print "ok 7\n"; + +$x = sprintf("%llx", $q); +print "not " unless hex($x) == 0x2dfdc1c35; +print "ok 8\n"; + +$x = sprintf("%Lx", $q); +print "not " unless hex($x) == 0x2dfdc1c35; +print "ok 9\n"; + +$x = sprintf("%qx", $q); +print "not " unless hex($x) == 0x2dfdc1c35; +print "ok 10\n"; + + +$x = sprintf("%o", $q); +print "not " unless oct("0$x") == 0133767016065; +print "ok 11\n"; + +$x = sprintf("%llo", $q); +print "not " unless oct("0$x") == 0133767016065; +print "ok 12\n"; + +$x = sprintf("%Lo", $q); +print "not " unless oct("0$x") == 0133767016065; +print "ok 13\n"; + +$x = sprintf("%qo", $q); +print "not " unless oct("0$x") == 0133767016065; +print "ok 14\n"; + + +$x = sprintf("%b", $q); +print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101; +print "ok 15\n"; + +$x = sprintf("%llb", $q); +print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101; +print "ok 16\n"; + +$x = sprintf("%Lb", $q); +print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101; +print "ok 17\n"; + +$x = sprintf("%qb", $q); +print "not " unless oct("0b$x") == 0b1011011111110111000001110000110101; +print "ok 18\n"; + + +$x = sprintf("%u", 12345678901); +print "not " unless $x eq "$q"; +print "ok 19\n"; + +$x = sprintf("%u", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 20\n"; + +$x = sprintf("%llu", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 21\n"; + +$x = sprintf("%Lu", $q); +print "not " unless $x == $q && $x eq $q; +print "ok 22\n"; + + +$x = $q + $r; +print "not " unless $x == 35802467913; +print "ok 23\n"; + +$x = $q - $r; +print "not " unless $x == -11111110111; +print "ok 24\n"; + +$x = $q * $r; +print "not " unless $x == 289589985190657035812; +print "ok 25\n"; + +$x /= $r; +print "not " unless $x == $q; +print "ok 26\n"; + +$x = 98765432109 % 12345678901; +print "not " unless $x == 901; +print "ok 27\n"; diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t index 5e467ae053..01b0f0529c 100755 --- a/t/pragma/utf8.t +++ b/t/pragma/utf8.t @@ -6,7 +6,7 @@ BEGIN { $ENV{PERL5LIB} = '../lib'; } -print "1..9\n"; +print "1..12\n"; my $test = 1; @@ -65,6 +65,18 @@ sub ok { ok $1, 'NUMERIC'; $test++; -} + $_ = "alpha123numeric456"; + m/([\p{IsDigit}]+)/; + ok $1, '123'; + $test++; + $_ = "alpha123numeric456"; + m/([^\p{IsDigit}]+)/; + ok $1, 'alpha'; + $test++; + $_ = ",123alpha,456numeric"; + m/([\p{IsAlnum}]+)/; + ok $1, '123alpha'; + $test++; +} |