Add tests for the BracketServer
This commit is contained in:
parent
0f808a371b
commit
cdc7517afa
1 changed files with 29 additions and 0 deletions
29
app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java
Normal file
29
app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package ch.nuth.zhaw.exbox;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
public class ADS1_3_test {
|
||||
BracketServer bs;
|
||||
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
bs = new BracketServer();
|
||||
}
|
||||
|
||||
private void test(String content, boolean expected) {
|
||||
assertEquals(expected, bs.checkBrackets(content), content);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBracket() {
|
||||
test("()", true);
|
||||
test("(()]", false);
|
||||
test("((([([])])))", true);
|
||||
test("[(])", false);
|
||||
test("[(3 +3)* 35 +3]* {3 +2}", true);
|
||||
test("[({3 +3)* 35} +3]* {3 +2}", false);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue