Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kota Mizushima
committed
Dec 19, 2016
1 parent
44446e2
commit 67cf54b
Showing
5 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.github.kmizu.jcombinator; | ||
|
||
import com.github.kmizu.jcombinator.showcase.regex.RegexInterpreter; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.JUnit4; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(JUnit4.class) | ||
public class RegexTest { | ||
private RegexInterpreter i; | ||
@Before | ||
public void initializeInterpreter() { | ||
i = new RegexInterpreter(); | ||
} | ||
@Test | ||
public void testPrimitives() { | ||
assertTrue(i.matches("a", "a")); | ||
assertFalse(i.matches("b", "a")); | ||
assertFalse(i.matches("a", "b")); | ||
assertTrue(i.matches(".", "a")); | ||
assertTrue(i.matches(".", "b")); | ||
} | ||
|
||
@Test | ||
public void testSequence() { | ||
assertTrue(i.matches("ab", "ab")); | ||
assertTrue(i.matches("bc", "bc")); | ||
assertTrue(i.matches(".a", "xa")); | ||
assertTrue(i.matches(".a", "ya")); | ||
assertTrue(i.matches(".a", "za")); | ||
assertFalse(i.matches(".a", "xb")); | ||
} | ||
} |