Skip to content

Commit a743920

Browse files
committed
Add unit tests for RemoveStars and ComplexNumber Multiply
1 parent a4b33c7 commit a743920

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.thealgorithms.strings;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
public class ComplexNumberMultiplyTest {
8+
9+
@Test
10+
void testExample() {
11+
assertEquals("0+2i", ComplexNumberMultiply.multiply("1+1i", "1+1i"));
12+
}
13+
14+
@Test
15+
void testNegative() {
16+
assertEquals("0+-2i", ComplexNumberMultiply.multiply("1+-1i", "1+-1i"));
17+
}
18+
19+
@Test
20+
void testZero() {
21+
assertEquals("0+0i", ComplexNumberMultiply.multiply("0+0i", "5+3i"));
22+
}
23+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.thealgorithms.strings;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
5+
import org.junit.jupiter.api.Test;
6+
7+
public class RemoveStarsTest {
8+
9+
@Test
10+
void testExampleCase() {
11+
assertEquals("lecoe", RemoveStars.removeStars("leet**cod*e"));
12+
}
13+
14+
@Test
15+
void testAllStars() {
16+
assertEquals("", RemoveStars.removeStars("abc***"));
17+
}
18+
19+
@Test
20+
void testNoStars() {
21+
assertEquals("hello", RemoveStars.removeStars("hello"));
22+
}
23+
24+
@Test
25+
void testSingleCharacter() {
26+
assertEquals("", RemoveStars.removeStars("a*"));
27+
}
28+
}

0 commit comments

Comments
 (0)