From 551f4f094e65e6f4121b6148f58ff8c4f8714422 Mon Sep 17 00:00:00 2001 From: dchandler Date: Thu, 14 Jul 2005 04:53:11 +0000 Subject: [PATCH] More EWTS->Unicode tests. --- source/org/thdl/tib/text/ttt/EWTSTest.java | 35 +++++++++++++++++----- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/source/org/thdl/tib/text/ttt/EWTSTest.java b/source/org/thdl/tib/text/ttt/EWTSTest.java index 4528cb4..dca358c 100644 --- a/source/org/thdl/tib/text/ttt/EWTSTest.java +++ b/source/org/thdl/tib/text/ttt/EWTSTest.java @@ -90,10 +90,14 @@ public class EWTSTest extends TestCase { = traits.scanner().scan(ewts, errors, -1, shortMessages, warningLevel); - if (null == scan) + if (null == scan) { + System.out.println("EWTS->TMW->Uni ho"); return null; - if (errors.length() > 0) + } + if (errors.length() > 0) { + System.out.println("EWTS->TMW->Uni ho: " + errors); return null; + } errors = new StringBuffer(); TibetanDocument tdoc = new TibetanDocument(); boolean rv; @@ -107,18 +111,26 @@ public class EWTSTest extends TestCase { // I doubt this can happen. throw new Error(e.toString()); } - if (!rv) + if (!rv) { + System.out.println("EWTS->TMW->Uni ho2"); return null; - if (tdoc.getLength() < 1 && ewts.length() > 0) + } + if (tdoc.getLength() < 1 && ewts.length() > 0) { + System.out.println("EWTS->TMW->Uni ho3"); return null; + } errors = new StringBuffer(); long numAttemptedReplacements[] = new long[] { 0 }; tdoc.convertToUnicode(0, tdoc.getLength(), errors, null, numAttemptedReplacements); - if (errors.length() > 0) - return null; - if (numAttemptedReplacements[0] < 1) + if (errors.length() > 0) { + System.out.println("EWTS->TMW->Uni ho4: " + errors); return null; + } + if (numAttemptedReplacements[0] < 1) { + System.out.println("NOTE: During TMW->Unicode for the EWTS '" + + ewts + "', we made no replacements."); + } try { return tdoc.getText(0, tdoc.getLength()); @@ -287,6 +299,15 @@ public class EWTSTest extends TestCase { /** Tests that the EWTS->unicode converter isn't completely braindead. */ public void testEwtsBasics() { + ewts2uni_test("\n\t\nga\nha\nha\tga\r", + "\n\t\n\u0f42\n\u0f67\n\u0f67\t\u0f42\r"); + ewts2uni_test("\n", "\n"); + ewts2uni_test("\r\n", "\r\n"); + ewts2uni_test("\n\r", "\n\r"); + ewts2uni_test("\r", "\r"); + ewts2uni_test("\t", "\t"); + ewts2uni_test("\t\n\n", "\t\n\n"); + just_ewts2uni_test("r+sa", "\u0f62\u0fb6"); ewts2uni_test("R+s", "\u0f6a\u0fb6");