blob: 573c5dafef345a9f98d0605765e53d8659e2b266 (
plain)
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
|
package morfologik.tools;
import java.io.*;
import morfologik.fsa.*;
import org.junit.Assert;
import org.junit.Test;
/*
*
*/
public class Text2FSA5Test {
@Test
public void testTool() throws Exception {
// Create a simple plain text file.
File input = File.createTempFile("input", "in");
File output = File.createTempFile("output", "fsa");
input.deleteOnExit();
output.deleteOnExit();
// Populate the file with data.
PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(input), "UTF-8"));
w.println("b");
w.println("cab");
w.println("ab");
w.close();
FSABuildTool.main(new String [] {
"--input", input.getAbsolutePath(),
"--output", output.getAbsolutePath()
});
FSA5 fsa = FSA.read(new FileInputStream(output));
Assert.assertEquals(3, new FSAInfo(fsa).finalStatesCount);
}
}
|