public static void main (String[] args) throws Throwable { TestSuite theSuite; if (args.length > 0) { theSuite = new TestSuite (); for (int i = 0; i < args.length; i++) { theSuite.addTest (new TestPipeUtils (args[i])); } } else { theSuite = (TestSuite) suite (); } junit.textui.TestRunner.run (theSuite); }
public void testConcatenateBadPipes () { Pipe p1 = new SimpleTaggerSentence2TokenSequence (); // force resolving data alphabet Alphabet dict1 = p1.getDataAlphabet (); Pipe p2 = new SimpleTaggerSentence2TokenSequence (); // force resolving data alphabet Alphabet dict2 = p2.getDataAlphabet (); assertTrue (dict1 != dict2); try { PipeUtils.concatenatePipes (p1, p2); assertTrue ("Test failed: concatenatePipes() allowed putting together incompatible alphabets.", false); } catch (IllegalArgumentException e) { // Exception expected } }
public void testConcatenatePipes () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence (); // initialize p2's dict p2.instanceFrom(new Instance (data, null, null, null)); assertEquals (3, p2.getDataAlphabet ().size()); Pipe serial = PipeUtils.concatenatePipes (p1, p2); Alphabet dict = serial.getDataAlphabet (); assertEquals (3, dict.size ()); assertTrue (dict == p2.getDataAlphabet ()); }
public void testConcatenateNullPipes () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence (); Pipe serial = PipeUtils.concatenatePipes (p1, p2); p2.instanceFrom(new Instance (data, null, null, null)); assertEquals (3, serial.getDataAlphabet ().size ()); }
public void testConcatenatePipes () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence (); // initialize p2's dict p2.instanceFrom(new Instance (data, null, null, null)); assertEquals (3, p2.getDataAlphabet ().size()); Pipe serial = PipeUtils.concatenatePipes (p1, p2); Alphabet dict = serial.getDataAlphabet (); assertEquals (3, dict.size ()); assertTrue (dict == p2.getDataAlphabet ()); }
public void testConcatenateNullPipes () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTagger.SimpleTaggerSentence2FeatureVectorSequence (); Pipe serial = PipeUtils.concatenatePipes (p1, p2); p2.instanceFrom(new Instance (data, null, null, null)); assertEquals (3, serial.getDataAlphabet ().size ()); }
public static void main (String[] args) throws Throwable { TestSuite theSuite; if (args.length > 0) { theSuite = new TestSuite (); for (int i = 0; i < args.length; i++) { theSuite.addTest (new TestPipeUtils (args[i])); } } else { theSuite = (TestSuite) suite (); } junit.textui.TestRunner.run (theSuite); }
public void testConcatenateBadPipes () { Pipe p1 = new SimpleTaggerSentence2TokenSequence (); // force resolving data alphabet Alphabet dict1 = p1.getDataAlphabet (); Pipe p2 = new SimpleTaggerSentence2TokenSequence (); // force resolving data alphabet Alphabet dict2 = p2.getDataAlphabet (); assertTrue (dict1 != dict2); try { PipeUtils.concatenatePipes (p1, p2); assertTrue ("Test failed: concatenatePipes() allowed putting together incompatible alphabets.", false); } catch (IllegalArgumentException e) { // Exception expected } }
public void testPipesAreStupid () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTaggerSentence2TokenSequence (); // initialize p2's dict p2.instanceFrom(new Instance (data, null, null, null)); Pipe serial = new SerialPipes (new Pipe[] { p1, p2 }); try { serial.getDataAlphabet (); assertTrue ("Test failed: Should have generated exception.", false); } catch (IllegalStateException e) {} }
public void testPipesAreStupid () { Pipe p1 = new StupidPipe (); Pipe p2 = new SimpleTaggerSentence2TokenSequence (); // initialize p2's dict p2.instanceFrom(new Instance (data, null, null, null)); Pipe serial = new SerialPipes (new Pipe[] { p1, p2 }); try { serial.getDataAlphabet (); assertTrue ("Test failed: Should have generated exception.", false); } catch (IllegalStateException e) {} }