-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Hello,
I came across some behavior I find unexpected, but I am unsure if it is indeed unintended or not.
Here's a unit test I created using release 2.1.3 of morfologik-fsa and morfologik-fsa-builders:
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import morfologik.fsa.FSA;
import morfologik.fsa.FSATraversal;
import morfologik.fsa.MatchResult;
import morfologik.fsa.builders.FSABuilder;
public class MorfologikTest {
@Test
public void expected() throws Exception {
List<byte[]> inputs = new ArrayList<>();
inputs.add("a".getBytes("UTF-8"));
FSA fsa = FSABuilder.build(inputs);
FSATraversal fsaTraversal = new FSATraversal(fsa);
MatchResult match = fsaTraversal.match("ax".getBytes("UTF-8"));
assertEquals(MatchResult.AUTOMATON_HAS_PREFIX, match.kind);
}
@Test
public void unexpected() throws Exception {
List<byte[]> inputs = new ArrayList<>();
inputs.add("a".getBytes("UTF-8"));
inputs.add("ab".getBytes("UTF-8"));
FSA fsa = FSABuilder.build(inputs);
FSATraversal fsaTraversal = new FSATraversal(fsa);
MatchResult match = fsaTraversal.match("ax".getBytes("UTF-8"));
assertEquals(MatchResult.AUTOMATON_HAS_PREFIX, match.kind);
}
}
The test "expected" is successful ("green"), but the test "unexpected" fails ("red"), because match.kind is "NO_MATCH".
Is "NO_MATCH" the intended result or is there something wrong with my test?