Add tests for the BracketServer

This commit is contained in:
Manuel Thalmann 2022-09-27 13:04:02 +02:00
parent 0f808a371b
commit cdc7517afa

View 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);
}
}