Commit 92fcb256 authored by Younis's avatar Younis
Browse files

Add new file TwoSumsTest

parent 739e6112
import static org.junit.Assert.*;
import org.junit.Test;
public class TwoSumsTest {
@Test
public void testStudentOneSolution() {
int[] nums = { 2, 7, 11, 15 };
int target = 18;
int[][] expectedPairs = {{2, 16}, {7, 11}};
int[][] expectedIndices = {{0, 3}, {1, 2}};
// Replace StudentOneSolution with the actual name of the class submitted by the first student
int[][] actualPairs = StudentOneSolution.findPairs(nums, target);
int[][] actualIndices = StudentOneSolution.findIndices(nums, target);
assertArrayEquals(expectedPairs, actualPairs);
assertArrayEquals(expectedIndices, actualIndices);
}
@Test
public void testStudentTwoSolution() {
int[] nums = { 2, 7, 11, 15 };
int target = 18;
int[][] expectedPairs = {{2, 16}, {7, 11}};
int[][] expectedIndices = {{0, 3}, {1, 2}};
// Replace StudentTwoSolution with the actual name of the class submitted by the second student
int[][] actualPairs = StudentTwoSolution.findPairs(nums, target);
int[][] actualIndices = StudentTwoSolution.findIndices(nums, target);
assertArrayEquals(expectedPairs, actualPairs);
assertArrayEquals(expectedIndices, actualIndices);
}
@Test
public void testStudentThreeSolution() {
int[] nums = { 2, 7, 11, 15 };
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment