Skip to content

Commit

Permalink
Add ReverseStringTest (#3607)
Browse files Browse the repository at this point in the history
Co-authored-by: jtuong <Rofleveryday1?>
  • Loading branch information
Tuong328 authored Oct 22, 2022
1 parent 8d4b048 commit f35aeb5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/java/com/thealgorithms/strings/ReverseStringTest.java
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);
}
}

0 comments on commit f35aeb5

Please sign in to comment.