1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/**
* Copyright 2001 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and
* redistribution of this file, and for a DISCLAIMER OF ALL
* WARRANTIES.
*/
package tests;
import junit.framework.*;
import java.util.*;
import java.io.*;
import java.net.URL;
import com.sun.speech.freetts.*;
import com.sun.speech.freetts.diphone.DiphoneUnitDatabase;
/**
* JUnit Tests for the DiphoneUnitDatabase test.
*
* @version 1.0
*/
public class UnitDatabaseTests extends TestCase {
DiphoneUnitDatabase udb;
private final static String BINARY_DB =
"file:../bld/classes/com/sun/speech/freetts/en/us/cmu_us_kal/cmu_us_kal.bin";
private final static String TEXT_DB =
"file:../com/sun/speech/freetts/en/us/cmu_us_kal/cmu_us_kal.txt";
/**
* Creates the set of UtteranceTests
*
* @param name the name of the test.
*/
public UnitDatabaseTests(String name) {
super(name);
}
/**
* Common code run before each test
*/
protected void setUp() {
try {
udb = new DiphoneUnitDatabase(new
URL(BINARY_DB), true);
} catch (IOException ioe) {
System.out.println("Can't load db " + ioe);
}
}
/**
* Checks to make sure that the binary and text version of the DB
* compare.
*/
public void testIdentical() {
DiphoneUnitDatabase udbTextVersion = null;
try {
udbTextVersion = new DiphoneUnitDatabase(
new URL(TEXT_DB), false);
} catch (IOException ioe) {
System.out.println("Can't load text db " + ioe);
}
assertTrue("db loaded", udb != null);
assertTrue("txt db loaded", udbTextVersion != null);
assertTrue("DBs identical", udb.compare(udbTextVersion));
}
/**
* Common code run after each test
*/
protected void tearDown() {
//utterance = null;
}
/**
* Tests to see that we succeed
*/
public void testSuccess() {
assertTrue("Should succeed", true);
}
/**
* Factory method that creates the test suite.
*
* @return the test suite.
*/
public static Test suite() {
return new TestSuite(UnitDatabaseTests.class);
}
/**
* Main entry point for this test suite.
*
* @param args the command line arguments.
*/
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
}
|