From cdc7517afae8a6e471f211ae45ee1e6ec228d376 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Tue, 27 Sep 2022 13:04:02 +0200 Subject: [PATCH] Add tests for the `BracketServer` --- .../java/ch/nuth/zhaw/exbox/ADS1_3_test.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java diff --git a/app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java b/app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java new file mode 100644 index 0000000..414be10 --- /dev/null +++ b/app/src/test/java/ch/nuth/zhaw/exbox/ADS1_3_test.java @@ -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); + } +}