Change 14138 by jhi@alpha on 2002/01/08 19:01:16

        unifold is really an op test since it requires
        no external modules for its actual testing:
        only the unicore CaseFold.txt file, and File::Spec
        to portably access that file.

Affected files ...

.... //depot/perl/MANIFEST#697 edit
.... //depot/perl/lib/unifold.t#3 delete
.... //depot/perl/t/op/unifold.t#1 add

Differences ...

==== //depot/perl/MANIFEST#697 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST.~1~   Tue Jan  8 12:15:05 2002
+++ perl/MANIFEST       Tue Jan  8 12:15:05 2002
@@ -1084,14 +1084,14 @@
 lib/Math/BigInt/t/bigintc.t    See if BigInt/Calc.pm works
 lib/Math/BigInt/t/bigintpm.inc Shared tests for bigintpm.t and sub_mbi.t
 lib/Math/BigInt/t/bigintpm.t   See if BigInt.pm works
-lib/Math/BigInt/t/require.t    Test if require Math::BigInt works
-lib/Math/BigInt/t/use.t                Test if use Math::BigInt(); works
 lib/Math/BigInt/t/calling.t    Test calling conventions
+lib/Math/BigInt/t/mbimbf.inc   Actual BigInt/BigFloat accuracy, precicion and 
+fallback, round_mode tests
 lib/Math/BigInt/t/mbimbf.t     BigInt/BigFloat accuracy, precicion and fallback, 
round_mode
-lib/Math/BigInt/t/mbimbf.inc   Actual BigInt/BigFloat accuracy, precicion and 
fallback, round_mode tests
+lib/Math/BigInt/t/require.t    Test if require Math::BigInt works
 lib/Math/BigInt/t/sub_mbf.t    Empty subclass test of BigFloat
 lib/Math/BigInt/t/sub_mbi.t    Empty subclass test of BigInt
 lib/Math/BigInt/t/sub_mif.t    Test A & P with subclasses using mbimbf.inc
+lib/Math/BigInt/t/use.t                Test if use Math::BigInt(); works
 lib/Math/Complex.pm            A Complex package
 lib/Math/Complex.t             See if Math::Complex works
 lib/Math/Trig.pm               A simple interface to complex trigonometry
@@ -1214,10 +1214,10 @@
 lib/Pod/t/basic.pod            podlators test
 lib/Pod/t/basic.t              podlators test
 lib/Pod/t/basic.txt            podlators test
-lib/Pod/t/man.t                podlators test
 lib/Pod/t/Functions.t          See if Pod::Functions works
 lib/Pod/t/InputObjects.t       See if Pod::InputObjects works
 lib/Pod/t/latex.t              Test for Pod::LaTeX
+lib/Pod/t/man.t                podlators test
 lib/Pod/t/parselink.t          podlators test
 lib/Pod/t/text-errors.t                podlators test
 lib/Pod/t/utils.t              Test for Pod::ParseUtils
@@ -1702,7 +1702,6 @@
 lib/unicore/Unicode.html       Unicode character database
 lib/unicore/Unicode.txt                Unicode character database
 lib/unicore/version            The version of the Unicode
-lib/unifold.t                  See if Unicode folding works
 lib/UNIVERSAL.pm               Base class for ALL classes
 lib/User/grent.pm              By-name interface to Perl's builtin getgr*
 lib/User/grent.t               See if User::grwent works
@@ -2316,6 +2315,7 @@
 t/op/time.t                    See if time functions work
 t/op/tr.t                      See if tr works
 t/op/undef.t                   See if undef works
+t/op/unifold.t                 See if Unicode folding works
 t/op/universal.t               See if UNIVERSAL class works
 t/op/unshift.t                 See if unshift works
 t/op/utf8decode.t              See if UTF-8 decoding works

==== //depot/perl/t/op/unifold.t#1 (text) ====
Index: perl/t/op/unifold.t
--- perl/t/op/unifold.t.~1~     Tue Jan  8 12:15:05 2002
+++ perl/t/op/unifold.t Tue Jan  8 12:15:05 2002
@@ -0,0 +1,46 @@
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+use File::Spec;
+
+my $CF = File::Spec->catfile(File::Spec->catdir(File::Spec->updir,
+                                              "lib", "unicore"),
+                           "CaseFold.txt");
+
+if (open(CF, $CF)) {
+    my @CF;
+
+    while (<CF>) {
+        if (/^([0-9A-F]+); ([CFSI]); ((?:[0-9A-F]+)(?: [0-9A-F]+)*); \# (.+)/) {
+            next if $2 eq 'S'; # we are going for 'F'ull case folding
+           push @CF, [$1, $2, $3, $4];
+       }
+    }
+
+    die qq[$0: failed to find casefoldings from "$CF"\n] unless @CF;
+
+    print "1..", scalar @CF, "\n";
+
+    my $i = 0;
+    for my $cf (@CF) {
+       my ($code, $status, $mapping, $name) = @$cf;
+       $i++;
+       my $a = pack("U0U*", hex $code);
+       my $b = pack("U0U*", map { hex } split " ", $mapping);
+       my $t0 = ":$a:" =~ /:$a:/    ? 1 : 0;
+       my $t1 = ":$a:" =~ /:$a:/i   ? 1 : 0;
+       my $t2 = ":$a:" =~ /:[$a]:/  ? 1 : 0;
+       my $t3 = ":$a:" =~ /:[$a]:/i ? 1 : 0;
+       my $t4 = ":$a:" =~ /:$b:/i   ? 1 : 0;
+       my $t5 = ":$a:" =~ /:[$b]:/i ? 1 : 0;
+       my $t6 = ":$b:" =~ /:$a:/i   ? 1 : 0;
+       my $t7 = ":$b:" =~ /:[$a]:/i ? 1 : 0;
+       print $t0 && $t1 && $t2 && $t3 && $t4 && $t5 && $t6 && $t7 ?
+           "ok $i \# - $code - $name - $mapping - $status\n" :
+           "not ok $i \# - $code - $name - $mapping - $status - $t0 $t1 $t2 $t3 $t4 
+$t5 $t6 $t7\n";
+    }
+} else {
+    die qq[$0: failed to open "$CF": $!\n];
+}
End of Patch.

Reply via email to