|
@@ -4,8 +4,6 @@ import org.junit.Assert;
|
4
|
4
|
import org.junit.Before;
|
5
|
5
|
import org.junit.Test;
|
6
|
6
|
|
7
|
|
-import java.util.Stack;
|
8
|
|
-
|
9
|
7
|
public class ParenCheckerTest {
|
10
|
8
|
ParenChecker parenChecker = new ParenChecker();
|
11
|
9
|
//Stack stack = new Stack();
|
|
@@ -16,25 +14,25 @@ public class ParenCheckerTest {
|
16
|
14
|
}
|
17
|
15
|
|
18
|
16
|
@Test
|
19
|
|
- public void isParanCurlyBrackTest(){
|
|
17
|
+ public void isOpenOrCloseTest(){
|
20
|
18
|
//GIVEN
|
21
|
19
|
char c = '}';
|
22
|
20
|
|
23
|
21
|
boolean expected = true;
|
24
|
22
|
//WHEN
|
25
|
|
- boolean actual = parenChecker.isParanCurlyBrack(c);
|
|
23
|
+ boolean actual = parenChecker.isOpenOrClose(c);
|
26
|
24
|
//THEN
|
27
|
25
|
Assert.assertEquals(expected, actual);
|
28
|
26
|
}
|
29
|
27
|
|
30
|
28
|
@Test
|
31
|
|
- public void isParanCurlyBrackTestFalse(){
|
|
29
|
+ public void isOpenOrCloseTestFalse(){
|
32
|
30
|
//GIVEN
|
33
|
31
|
char c = 'g';
|
34
|
32
|
|
35
|
33
|
boolean expected = false;
|
36
|
34
|
//WHEN
|
37
|
|
- boolean actual = parenChecker.isParanCurlyBrack(c);
|
|
35
|
+ boolean actual = parenChecker.isOpenOrClose(c);
|
38
|
36
|
//THEN
|
39
|
37
|
Assert.assertEquals(expected, actual);
|
40
|
38
|
}
|
|
@@ -104,7 +102,7 @@ public class ParenCheckerTest {
|
104
|
102
|
@Test
|
105
|
103
|
public void paranChecker(){
|
106
|
104
|
//GIVEN
|
107
|
|
- String word = "(word)";
|
|
105
|
+ String word = "<>(word)";
|
108
|
106
|
|
109
|
107
|
boolean expected = true;
|
110
|
108
|
//WHEN
|
|
@@ -127,7 +125,7 @@ public class ParenCheckerTest {
|
127
|
125
|
@Test
|
128
|
126
|
public void paranCheckerCurly(){
|
129
|
127
|
//GIVEN
|
130
|
|
- String word = "({word})";
|
|
128
|
+ String word = "\"\"({word})";
|
131
|
129
|
|
132
|
130
|
boolean expected = true;
|
133
|
131
|
//WHEN
|
|
@@ -148,4 +146,28 @@ public class ParenCheckerTest {
|
148
|
146
|
Assert.assertEquals(expected, actual);
|
149
|
147
|
}
|
150
|
148
|
|
|
149
|
+ @Test
|
|
150
|
+ public void checkQuotesTestFalse(){
|
|
151
|
+ //GIVEN
|
|
152
|
+ String word = "\'{({word})}";
|
|
153
|
+
|
|
154
|
+ boolean expected = false;
|
|
155
|
+ //WHEN
|
|
156
|
+ boolean actual = parenChecker.isBalancedParens(word);
|
|
157
|
+ //THEN
|
|
158
|
+ Assert.assertEquals(expected, actual);
|
|
159
|
+ }
|
|
160
|
+
|
|
161
|
+ @Test
|
|
162
|
+ public void checkQuotesTest(){
|
|
163
|
+ //GIVEN
|
|
164
|
+ String word = "\"\'{({word})}\'\"";
|
|
165
|
+
|
|
166
|
+ boolean expected = true;
|
|
167
|
+ //WHEN
|
|
168
|
+ boolean actual = parenChecker.isBalancedParens(word);
|
|
169
|
+ //THEN
|
|
170
|
+ Assert.assertEquals(expected, actual);
|
|
171
|
+ }
|
|
172
|
+
|
151
|
173
|
}
|