Added a test for org.thdl.tib.text.tshegbar.UnicodeCodepointToThdlWylie.

This commit is contained in:
dchandler 2003-03-22 04:55:17 +00:00
parent f2dcb0cbc3
commit 08d2a5d702
3 changed files with 79 additions and 0 deletions

View file

@ -371,6 +371,11 @@
<param name="my.included.source.file"
value="org/thdl/tib/text/tshegbar/UnicodeGraphemeClusterTest.java"/>
</antcall>
<antcall target="our-internal-javac-task">
<param name="mybin" value="${junitbin}"/>
<param name="my.included.source.file"
value="org/thdl/tib/text/tshegbar/UnicodeCodepointToThdlWylieTest.java"/>
</antcall>
</target>
<!-- Builds the standalone translation tool: -->

View file

@ -46,6 +46,7 @@
<test name="org.thdl.tib.text.tshegbar.UnicodeUtilsTest"/>
<test name="org.thdl.tib.text.tshegbar.LegalTshegBarTest"/>
<test name="org.thdl.tib.text.tshegbar.UnicodeGraphemeClusterTest"/>
<test name="org.thdl.tib.text.tshegbar.UnicodeCodepointToThdlWylieTest"/>
</junit>
</target>

View file

@ -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"));
}
}