summaryrefslogtreecommitdiff
path: root/t/op/bop.t
diff options
context:
space:
mode:
authorSimon Cozens <simon@netthink.co.uk>2000-10-14 21:52:13 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-10-15 16:24:44 +0000
commit1d68d6cd5ca16f48de9798b0758052a6de564551 (patch)
treecec6cf88c7c24c5ae0d5f41e34d4cc88133d4df8 /t/op/bop.t
parent93f04dac2ed878fbeae5ba64df628ed3ab0b6e21 (diff)
downloadperl-1d68d6cd5ca16f48de9798b0758052a6de564551.tar.gz
Make ~(chr(a).chr(b)) eq chr(~a).chr(~b) on utf8.
Subject: [PATCH] Re: [ID 20000918.005] ~ on wide chars Message-ID: <20001014205213.A9645@pembro4.pmb.ox.ac.uk> p4raw-id: //depot/perl@7235
Diffstat (limited to 't/op/bop.t')
-rwxr-xr-xt/op/bop.t25
1 files changed, 21 insertions, 4 deletions
diff --git a/t/op/bop.t b/t/op/bop.t
index 92baa67bd9..4bdc26b74e 100755
--- a/t/op/bop.t
+++ b/t/op/bop.t
@@ -9,7 +9,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..35\n";
+print "1..37\n";
# numerics
print ((0xdead & 0xbeef) == 0x9ead ? "ok 1\n" : "not ok 1\n");
@@ -82,9 +82,9 @@ print "ok 28\n" if sprintf("%vd", v4095.801.4095 & v801.4095) eq '801.801';
print "ok 29\n" if sprintf("%vd", v4095.801.4095 | v801.4095) eq '4095.4095.4095';
print "ok 30\n" if sprintf("%vd", v801.4095 ^ v4095.801.4095) eq '3294.3294.4095';
#
-print "ok 31\n" if sprintf("%vd", v120.v300 & v200.400) eq '72.256';
-print "ok 32\n" if sprintf("%vd", v120.v300 | v200.400) eq '248.444';
-print "ok 33\n" if sprintf("%vd", v120.v300 ^ v200.400) eq '176.188';
+print "ok 31\n" if sprintf("%vd", v120.300 & v200.400) eq '72.256';
+print "ok 32\n" if sprintf("%vd", v120.300 | v200.400) eq '248.444';
+print "ok 33\n" if sprintf("%vd", v120.300 ^ v200.400) eq '176.188';
#
my $a = v120.300;
my $b = v200.400;
@@ -94,3 +94,20 @@ my $a = v120.300;
my $b = v200.400;
$a |= $b;
print "ok 35\n" if sprintf("%vd", $a) eq '248.444';
+#
+# UTF8 ~ behaviour
+for (0x100...0xFFF) {
+ $a = ~(chr $_);
+ print "not" if $a ne chr(~$_) or length($a) != 1 or ~$a ne chr($_);
+}
+print "ok 36\n";
+
+for my $i (0xEEE...0xF00) {
+ for my $j (0x0..0x120) {
+ $a = ~(chr ($i) . chr $j);
+ print "not" if $a ne chr(~$i).chr(~$j)
+ or length($a) != 2
+ or ~$a ne chr($i).chr($j);
+ }
+}
+print "ok 37\n";