Moved ad-hoc test.java test cases to LegalTshegBarTest.java, a JUnit

test which can be run via 'ant check'.
This commit is contained in:
dchandler 2003-03-22 03:46:32 +00:00
parent 879b477902
commit 395eca7bb1
4 changed files with 74 additions and 22 deletions

View File

@ -367,6 +367,11 @@
<param name="my.included.source.file"
value="org/thdl/tib/text/tshegbar/UnicodeUtilsTest.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/LegalTshegBarTest.java"/>
</antcall>
</target>
<!-- Builds the standalone translation tool: -->

View File

@ -44,6 +44,7 @@
<test name="org.thdl.util.ThdlLazyExceptionTest"/>
<test name="org.thdl.util.TrieTest"/>
<test name="org.thdl.tib.text.tshegbar.UnicodeUtilsTest"/>
<test name="org.thdl.tib.text.tshegbar.LegalTshegBarTest"/>
</junit>
</target>

View File

@ -0,0 +1,68 @@
/*
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.LegalTshegBar} at the unit level.
*/
public class LegalTshegBarTest extends TestCase implements UnicodeConstants {
/**
* Plain vanilla constructor for LegalTshegBarTest.
* @param arg0
*/
public LegalTshegBarTest(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(LegalTshegBarTest.class);
}
/** Tests the getThdlWylie() method and one of the constructors. */
public void testGetThdlWylie() {
assertTrue(new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga, EWSUB_ra_btags,
false, true, EWC_la, EWC_sa, EWV_o).getThdlWylie().toString().equals("bsgrAols"));
assertTrue(new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga,
EWSUB_ra_btags, true, true,
EWC_la, EWC_sa, EWV_o).getThdlWylie().toString().equals("bsgrwAols"));
assertTrue(new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga,
EWSUB_ra_btags, false, false,
EWC_la, EWC_sa, EWV_o).getThdlWylie().toString().equals("bsgrols"));
}
/** Tests the formsLegalTshegBar(..) method. DLC FIXME: but
* doesn't test it very well. */
public void testFormsLegalTshegBar() {
// Ensure that EWTS's jskad is not legal:
assertTrue(!LegalTshegBar.formsLegalTshegBar(EWC_ja, EWC_sa,
EWC_ka, EW_ABSENT,
false, false,
EW_ABSENT, EWC_da,
EW_ABSENT));
assertTrue(LegalTshegBar.formsLegalTshegBar(EWC_ba, EW_ABSENT,
EWC_ta, EW_ABSENT,
false, false,
EWC_da, EW_ABSENT,
EW_ABSENT));
}
}

View File

@ -37,28 +37,6 @@ public class test implements UnicodeConstants {
super();
testTopToBottomForLegalGraphemeClusters();
String ew
= new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga,
EWSUB_ra_btags, false, true,
EWC_la, EWC_sa, EWV_o).getThdlWylie().toString();
System.out.println("DLC: t-b 1: " + ew);
ThdlDebug.verify(ew.equals("bsgrAols"));
ThdlDebug.verify(ew.equals("bsgrAols"));
ThdlDebug.verify(new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga,
EWSUB_ra_btags, true, true,
EWC_la, EWC_sa, EWV_o).getThdlWylie().toString().equals("bsgrwAols"));
ThdlDebug.verify(new LegalTshegBar(EWC_ba, EWC_sa, EWC_ga,
EWSUB_ra_btags, false, false,
EWC_la, EWC_sa, EWV_o).getThdlWylie().toString().equals("bsgrols"));
// Ensure that EWTS's jskad is not legal:
ThdlDebug.verify(!LegalTshegBar.formsLegalTshegBar(EWC_ja, EWC_sa,
EWC_ka, EW_ABSENT,
false, false,
EW_ABSENT, EWC_da,
EW_ABSENT));
}
/** Unit tests this package. */