Skip to content

Commit

Permalink
test: write test case
Browse files Browse the repository at this point in the history
  • Loading branch information
rldnrl committed Nov 5, 2022
1 parent bba2712 commit 002d2f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/leetcode/TwoSumTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package leetcode;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;


class TwoSumTest {
@Test
void twoSumTest() {
int[] testNums1 = new int[] {2,7,11,15};
int target1 = 9;
int[] result1 = new int[] {0, 1};
Assertions.assertArrayEquals(TwoSum.twoSum(testNums1, target1), result1);

int[] testNum2 = new int[] {3, 2, 4};
int target2 = 6;
int[] result2 = new int[] {1, 2};
Assertions.assertArrayEquals(TwoSum.twoSum(testNum2, target2), result2);

int[] testNum3 = new int[] {3, 3};
int target3 = 6;
int[] result3 = new int[] {0, 1};
Assertions.assertArrayEquals(TwoSum.twoSum(testNum3, target3), result3);
}
}

0 comments on commit 002d2f4

Please sign in to comment.