2 * Copyright 2001 Sun Microsystems, Inc.
4 * See the file "license.terms" for information on usage and
5 * redistribution of this file, and for a DISCLAIMER OF ALL
9 import junit.framework.*;
13 import com.sun.speech.freetts.*;
14 import com.sun.speech.freetts.diphone.DiphoneUnitDatabase;
17 * JUnit Tests for the DiphoneUnitDatabase test.
21 public class UnitDatabaseTests extends TestCase {
22 DiphoneUnitDatabase udb;
23 private final static String BINARY_DB =
24 "file:../bld/classes/com/sun/speech/freetts/en/us/cmu_us_kal/cmu_us_kal.bin";
25 private final static String TEXT_DB =
26 "file:../com/sun/speech/freetts/en/us/cmu_us_kal/cmu_us_kal.txt";
29 * Creates the set of UtteranceTests
31 * @param name the name of the test.
33 public UnitDatabaseTests(String name) {
38 * Common code run before each test
40 protected void setUp() {
42 udb = new DiphoneUnitDatabase(new
43 URL(BINARY_DB), true);
44 } catch (IOException ioe) {
45 System.out.println("Can't load db " + ioe);
51 * Checks to make sure that the binary and text version of the DB
54 public void testIdentical() {
55 DiphoneUnitDatabase udbTextVersion = null;
57 udbTextVersion = new DiphoneUnitDatabase(
58 new URL(TEXT_DB), false);
60 } catch (IOException ioe) {
61 System.out.println("Can't load text db " + ioe);
63 assertTrue("db loaded", udb != null);
64 assertTrue("txt db loaded", udbTextVersion != null);
65 assertTrue("DBs identical", udb.compare(udbTextVersion));
71 * Common code run after each test
73 protected void tearDown() {
79 * Tests to see that we succeed
81 public void testSuccess() {
82 assertTrue("Should succeed", true);
87 * Factory method that creates the test suite.
89 * @return the test suite.
91 public static Test suite() {
92 return new TestSuite(UnitDatabaseTests.class);
98 * Main entry point for this test suite.
100 * @param args the command line arguments.
102 public static void main(String[] args) {
103 junit.textui.TestRunner.run(suite());