-
Notifications
You must be signed in to change notification settings - Fork 19.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: jtuong <Rofleveryday1?>
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/test/java/com/thealgorithms/strings/ReverseStringTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.thealgorithms.strings; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ReverseStringTest { | ||
|
||
@Test | ||
public void ReverseStringTest() { | ||
String input1 = "Hello World"; | ||
String input2 = "helloworld"; | ||
String input3 = "123456789"; | ||
String input4 = ""; | ||
|
||
String expectedOutput1 = "dlroW olleH"; | ||
String expectedOutput2 = "dlrowolleh"; | ||
String expectedOutput3 = "987654321"; | ||
String expectedOutput4 = ""; | ||
|
||
assertEquals(ReverseString.reverse(input1), expectedOutput1); | ||
assertEquals(ReverseString.reverse(input2), expectedOutput2); | ||
assertEquals(ReverseString.reverse(input3), expectedOutput3); | ||
assertEquals(ReverseString.reverse(input4), expectedOutput4); | ||
|
||
assertEquals(ReverseString.reverse2(input1), expectedOutput1); | ||
assertEquals(ReverseString.reverse2(input2), expectedOutput2); | ||
assertEquals(ReverseString.reverse2(input3), expectedOutput3); | ||
assertEquals(ReverseString.reverse2(input4), expectedOutput4); | ||
} | ||
} |