diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/BracketTest.java | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/test/BracketTest.java b/src/test/BracketTest.java new file mode 100644 index 0000000..d554458 --- /dev/null +++ b/src/test/BracketTest.java @@ -0,0 +1,77 @@ +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class BracketTest { + @Test + void test() { + String exp = "[]"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test2() { + String exp = "{}[]"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test3() { + String exp = "[()]"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test4() { + String exp = "(())"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test5() { + String exp = "{[]}()"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test6() { + String exp = "{"; + assertEquals("1", Bracket.checkBracket(exp)); + } + + @Test + void test7() { + String exp = "{[}"; + assertEquals("3", Bracket.checkBracket(exp)); + } + + @Test + void test8() { + String exp = "foo(bar);"; + assertEquals("Success", Bracket.checkBracket(exp)); + } + + @Test + void test9() { + String exp = "foo(bar[i);"; + assertEquals("10", Bracket.checkBracket(exp)); + } + + @Test + void test10() { + String exp = "[](()"; + assertEquals("3", Bracket.checkBracket(exp)); + } + + @Test + void test11() { + String exp = "{[}haha"; + assertEquals("3", Bracket.checkBracket(exp)); + } + + @Test + void test12() { + String exp = "haha{[}"; + assertEquals("7", Bracket.checkBracket(exp)); + } +} |