mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-30 07:54:05 +08:00
@ -1,44 +1,43 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TwoPointersTest {
|
||||
|
||||
|
||||
@Test
|
||||
void twoPointersFirstTestCase(){
|
||||
int[] arr = {2,6,9,22,121};
|
||||
void twoPointersFirstTestCase() {
|
||||
int[] arr = {2, 6, 9, 22, 121};
|
||||
int key = 28;
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr,key));
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void twoPointersSecondTestCase(){
|
||||
int[] arr = {-1,-12,12,0,8};
|
||||
void twoPointersSecondTestCase() {
|
||||
int[] arr = {-1, -12, 12, 0, 8};
|
||||
int key = 0;
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr,key));
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void twoPointersThirdTestCase(){
|
||||
int[] arr = {12,35,12,152,0};
|
||||
void twoPointersThirdTestCase() {
|
||||
int[] arr = {12, 35, 12, 152, 0};
|
||||
int key = 13;
|
||||
assertEquals(false, TwoPointers.isPairedSum(arr,key));
|
||||
assertEquals(false, TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void twoPointersFourthTestCase(){
|
||||
int[] arr = {-2,5,-1,52,31};
|
||||
void twoPointersFourthTestCase() {
|
||||
int[] arr = {-2, 5, -1, 52, 31};
|
||||
int key = -3;
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr,key));
|
||||
assertEquals(true, TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
|
||||
@Test
|
||||
void twoPointersFiftiethTestCase(){
|
||||
int[] arr = {25,1,0,61,21};
|
||||
void twoPointersFiftiethTestCase() {
|
||||
int[] arr = {25, 1, 0, 61, 21};
|
||||
int key = 12;
|
||||
assertEquals(false, TwoPointers.isPairedSum(arr,key));
|
||||
assertEquals(false, TwoPointers.isPairedSum(arr, key));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user