Fresco/Babylon/test Makefile.in,1.6,1.7 ucd.pl,1.1,1.2
Tobias Hunger <[email protected]> Mon, 04 Aug 2003 13:59:38 -0500
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Babylon/test
In directory purcel:/tmp/cvs-serv20843/Babylon/test
Modified Files:
Makefile.in ucd.pl
Log Message:
* Add a unit test for characters without normalization: Those should
stay unchanged in all norms.
* Add FRESCO_TESTS environment var to specify whith test routines are
run by run_tests.sh in all tests. Run all tests if this variable is
unset.
Index: Makefile.in
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/test/Makefile.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- Makefile.in 1 Aug 2003 16:47:16 -0000 1.6
+++ Makefile.in 4 Aug 2003 18:59:36 -0000 1.7
@@ -67,7 +67,8 @@
ifdef FRESCO_TEST_CONFIG
run-tests: build-tests
- @echo Running tests, please wait...
+ @echo Running tests...
+ @echo These tests take a *LONG* time to complete, please be patient.
LD_LIBRARY_PATH=`$(FRESCO_TEST_CONFIG) --lib-dir`:$(top_builddir)/lib:$(DESTDIR)$(libdir):$(LD_LIBRARY_PATH) `$(FRESCO_TEST_CONFIG) --test-runner` $(TARGETS) $(SCRIPT_TARGETS)
else
run-tests:
Index: ucd.pl
===================================================================
RCS file: /cvs/fresco/Fresco/Babylon/test/ucd.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ucd.pl 1 Aug 2003 16:47:16 -0000 1.1
+++ ucd.pl 4 Aug 2003 18:59:36 -0000 1.2
@@ -8,7 +8,7 @@
my @registered_tests = ("test_ucd", "test_blocks", "test_linebreak",
"test_eawidth", "test_compexclude",
"test_properties", "test_coreproperties",
- "test_normalize");
+ "test_normalize", "test_unlisted_norms");
$MAKE_TOP_BUILDDIR = "@MAKE_TOP_BUILDDIR@";
$dump_ucd = "$MAKE_TOP_BUILDDIR/bin/dump_ucd $MAKE_TOP_BUILDDIR/modules";
@@ -19,6 +19,8 @@
$dump_props = "$MAKE_TOP_BUILDDIR/bin/dump_props $MAKE_TOP_BUILDDIR/modules";
$normalize = "$MAKE_TOP_BUILDDIR/bin/normalize interactive $MAKE_TOP_BUILDDIR/modules";
+$MAX_TEST = 0x110001;
+
# --------------------
my $running_test = "";
@@ -98,6 +100,7 @@
while(<UCD>)
{
+ next if /^$/;
# remove comments and names from UCD file, eval digit values:
my @parts = split ';', strip_WS($_), 15;
$parts[1] = "";
@@ -530,7 +533,8 @@
unless (open UCD, $unicode_normalize)
{
- abort("Can't open $unicode_ea", "Error opening file $unicode_ea");
+ abort("Can't open $unicode_normalize",
+ "Error opening file $unicode_normalize");
return;
}
@@ -610,9 +614,75 @@
close UCD;
pass() unless ($diff);
- fail("dump_ea output differs from the file downloaded.",
+ fail("normalize output differs from the file downloaded.",
"First difference:\n$diff\n Total: $total, not OK: $nok\n") if ($diff);
}
+
+sub test_unlisted_norms
+{
+ my $unicode_normalize = "NormalizationTest.txt";
+
+ system ("if [ ! -f $unicode_normalize ] ; then wget $ftp_path$unicode_normalize ; fi");
+
+ unless (open UCD, $unicode_normalize)
+ {
+ abort("Can't open $unicode_normalize",
+ "Error opening file $unicode_normalize");
+ return;
+ }
+
+ my $pid;
+ unless ($pid = open2( \*Reader, \*Writer, "$normalize"))
+ {
+ abort("Can't open pipes to $normalize", "Error opening pipes.");
+ return;
+ }
+
+ my $diff = "";
+ my $nok = 0;
+ my $total = 0;
+
+ my @listed_norms;
+ while(<UCD>)
+ {
+ my $orig = $_;
+ $orig =~ s/# \(.*\) (.*)\n$/# $1/;
+
+ s/\s*#.*$//;
+
+ # Only one letter in first position!
+ next unless (/^[A-F0-9]+;/);
+
+ my @c = split /;/, $_, 6;
+ $listed_norms{hex($c[0])} = 1;
+ }
+
+ for (my $i = 0; $i <= $MAX_TEST; $i++)
+ {
+ next if exists $listed_norms{$i};
+
+ printf Writer "n%X\n", $i;
+ my @res = split /;/, <Reader>, 6;
+ next if $res[0] eq "UNDEFINED CHARACTER\n";
+ if ($res[0] ne $res[1] || $res[0] ne $res[2] ||
+ $res[0] ne $res[3] || $res[0] ne $res[4])
+ {
+ $nok++;
+ $diff .= " Expected: $i: $i;$i;$i;$i;$i\n";
+ $diff .= " got : $i: $res[0];$res[1];$res[2];$res[3];$res[4]\n";
+ }
+ }
+
+ close *Reader;
+ close *Writer;
+ close UCD;
+
+ pass() unless ($diff);
+ fail("normalize output differs from the file downloaded.",
+ "First difference:\n$diff\n not OK: $nok\n") if ($diff);
+}
+
+
# --------------------