-
-
Notifications
You must be signed in to change notification settings - Fork 312
Expand file tree
/
Copy pathAddTest.java
More file actions
21 lines (16 loc) · 793 Bytes
/
AddTest.java
File metadata and controls
21 lines (16 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package ASS3;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class AddTest {
@Test
void test() {
TopKFrequentElements T = new TopKFrequentElements();
assertEquals("[]", T.topKFrequent(new int[] {}, 1).toString());
assertEquals("[2, 1]", T.topKFrequent(new int[] { 1, 1, 1, 2, 2, 3 }, 2).toString());
assertEquals("[0]", T.topKFrequent(new int[] { 3, 0, 1, 0 }, 1).toString());
assertEquals("[1]", T.topKFrequent(new int[] { 1 }, 1).toString());
assertEquals("[1, 2]", T.topKFrequent(new int[] { 1, 2 }, 2).toString());
assertEquals("[2, -1]", T.topKFrequent(new int[] { 4, 1, -1, 2, -1, 2, 3 }, 2).toString());
assertEquals("[1, -1, 2]", T.topKFrequent(new int[] { 4, 1, -1, 2, -1, 2, 1 }, 3).toString());
}
}