-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIntSetBSTTest.java
More file actions
56 lines (43 loc) · 1.01 KB
/
IntSetBSTTest.java
File metadata and controls
56 lines (43 loc) · 1.01 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package devSet;
import static org.junit.jupiter.api.Assertions.*;
import java.util.Random;
import org.junit.jupiter.api.Test;
class IntSetBSTTest {
IntSetBST bst = new IntSetBST();
private static int MAX_VAL = 1000000;
private static int MAX_ELE = MAX_VAL/100;
private static Random num = new Random();
@Test
void testIntSetImp() {
bst.intSetImp(MAX_ELE, MAX_VAL);
assertEquals(MAX_VAL, bst.maxval);
assertEquals(MAX_ELE, bst.maxelems);
}
@Test
void testInsert() {
bst.intSetImp(MAX_ELE, MAX_VAL);
int x =0;
for(int i=0;i<MAX_ELE;i++)
{
bst.insert(x++);
}
System.out.println("bst size: " + bst.size());
assertEquals(bst.size(), MAX_ELE);
}
@Test
void testReport() {
bst.intSetImp(MAX_ELE, MAX_VAL);
for(int i=0;i<MAX_ELE;i++)
{
bst.insert(num.nextInt(MAX_ELE));
}
bst.report();
for(int i=0;i<MAX_ELE;i++) {
assertEquals(bst.size(), bst.bst.getSize());
}
}
@Test
void testSize() {
bst.size();
}
}