From 08d2a5d70206b74ccc2cf82bb6f96fbdaad9b682 Mon Sep 17 00:00:00 2001 From: dchandler Date: Sat, 22 Mar 2003 04:55:17 +0000 Subject: [PATCH] Added a test for org.thdl.tib.text.tshegbar.UnicodeCodepointToThdlWylie. --- build.xml | 5 ++ junitbuild.xml | 1 + .../UnicodeCodepointToThdlWylieTest.java | 73 +++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 source/org/thdl/tib/text/tshegbar/UnicodeCodepointToThdlWylieTest.java diff --git a/build.xml b/build.xml index 070233d..9bc3592 100644 --- a/build.xml +++ b/build.xml @@ -371,6 +371,11 @@ + + + + diff --git a/junitbuild.xml b/junitbuild.xml index aafd347..1264f71 100644 --- a/junitbuild.xml +++ b/junitbuild.xml @@ -46,6 +46,7 @@ + diff --git a/source/org/thdl/tib/text/tshegbar/UnicodeCodepointToThdlWylieTest.java b/source/org/thdl/tib/text/tshegbar/UnicodeCodepointToThdlWylieTest.java new file mode 100644 index 0000000..88241d8 --- /dev/null +++ b/source/org/thdl/tib/text/tshegbar/UnicodeCodepointToThdlWylieTest.java @@ -0,0 +1,73 @@ +/* +The contents of this file are subject to the THDL Open Community License +Version 1.0 (the "License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License on the THDL web site +(http://www.thdl.org/). + +Software distributed under the License is distributed on an "AS IS" basis, +WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific terms governing rights and limitations under the +License. + +The Initial Developer of this software is the Tibetan and Himalayan Digital +Library (THDL). Portions created by the THDL are Copyright 2002-2003 THDL. +All Rights Reserved. + +Contributor(s): ______________________________________. +*/ + +package org.thdl.tib.text.tshegbar; + +import junit.framework.TestCase; + +/** + * @author David Chandler + * + * Tests {@link org.thdl.tib.text.tshegbar.UnicodeCodepointToThdlWylie} + * at the unit level. + */ +public class UnicodeCodepointToThdlWylieTest + extends TestCase implements UnicodeConstants +{ + /** + * Plain vanilla constructor for UnicodeCodepointToThdlWylieTest. + * @param arg0 + */ + public UnicodeCodepointToThdlWylieTest(String arg0) { + super(arg0); + } + /** Invokes a text UI and runs all this class's tests. */ + public static void main(String[] args) { + junit.textui.TestRunner.run(UnicodeCodepointToThdlWylieTest.class); + } + + /** + * Tests the {@link + * UnicodeCodepointToThdlWylie#getThdlWylieForUnicodeString(String)} + * method. */ + public void testGetThdlWylieForUnicodeString() { + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeString("\u0F00\u0F00").toString().equals("oMoM")); + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeString("").toString().equals("")); + + // This illustrates that getThdlWylieForUnicodeString doesn't + // work correctly when context is required. + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeString("\u0F56\u0F4F\u0F44").toString().equals("btng")); // "btng", not "btang" + + // test subscribed and superscribed letters: + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeString("\u0F62\u0F92\u0FB2").toString().equals("rgr")); + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeString("\u0F66\u0F91\u0FB2").toString().equals("skhr")); + } + + /** + * Tests the {@link + * UnicodeCodepointToThdlWylie#getThdlWylieForUnicodeCodepoint(char)} + * method. */ + public void testGetThdlWylieForUnicodeCodepoint() { + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeCodepoint('\u0F00').equals("oM")); + + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeCodepoint('\u0FB2').equals("r")); + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeCodepoint('\u0FBC').equals("r")); + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeCodepoint('\u0F6A').equals("r")); + assertTrue(UnicodeCodepointToThdlWylie.getThdlWylieForUnicodeCodepoint('\u0F62').equals("r")); + } +}