File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
src/test/java/com/thealgorithms/stacks Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .thealgorithms .stacks ;
2
+
3
+ import org .junit .jupiter .api .Test ;
4
+ import static org .junit .jupiter .api .Assertions .*;
5
+
6
+ class ReverseStringUsingStackTest {
7
+
8
+ @ Test
9
+ void testRegularString () {
10
+ assertEquals ("olleh" , ReverseStringUsingStack .reverse ("hello" ));
11
+ }
12
+
13
+ @ Test
14
+ void testEmptyString () {
15
+ assertEquals ("" , ReverseStringUsingStack .reverse ("" ));
16
+ }
17
+
18
+ @ Test
19
+ void testPalindromeString () {
20
+ assertEquals ("madam" , ReverseStringUsingStack .reverse ("madam" ));
21
+ }
22
+
23
+ @ Test
24
+ void testSpecialCharacters () {
25
+ assertEquals ("#@!321cba" , ReverseStringUsingStack .reverse ("abc123!@#" ));
26
+ }
27
+
28
+ @ Test
29
+ void testSingleCharacter () {
30
+ assertEquals ("x" , ReverseStringUsingStack .reverse ("x" ));
31
+ }
32
+
33
+ @ Test
34
+ void testWhitespaceHandling () {
35
+ assertEquals ("dlroW olleH" , ReverseStringUsingStack .reverse ("Hello World" ));
36
+ }
37
+ }
You can’t perform that action at this time.
0 commit comments