-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHashCommonTest.java
More file actions
35 lines (29 loc) · 1.02 KB
/
Copy pathHashCommonTest.java
File metadata and controls
35 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package hash;
import org.junit.Assert;
import org.junit.Test;
public class HashCommonTest {
@Test
public void letterCountTest() {
int i = LetterCount.letterCount("Hello word how are you I am fine thank you and you");
Assert.assertEquals(i, 6);
}
@Test
public void firstUniqueCharTest() {
int first = FirstCharacter.firstUniqChar("givenastring");
Assert.assertEquals(first, 2);
}
@Test
public void InersecitonTest() {
int[] intersection = IntersectionOfTwoArrays.intersection(new int[]{1, 2, 2, 1}, new int[]{2, 2});
for (int i : intersection) {
System.out.println(i);
}
}
@Test
public void ContainsDupulicateIITest() {
boolean isConatain = ContainsDuplicatesII.containsNearbyDuplicate(new int[]{1, 2, 3, 1}, 3);
Assert.assertEquals(isConatain, true);
boolean isConatain2 = ContainsDuplicatesII.containsNearbyDuplicate(new int[]{1, 2, 3, 1}, 2);
Assert.assertEquals(isConatain2, false);
}
}