-
Notifications
You must be signed in to change notification settings - Fork 0
/
TreeGeneratorTest.java
63 lines (53 loc) · 1.8 KB
/
TreeGeneratorTest.java
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
57
58
59
60
61
62
63
package recommender.sol;
import tester.Tester;
import java.util.LinkedList;
/**
* class to test methods in TreeGenerator
*/
public class TreeGeneratorTest {
/**
* sets up dataset of vegetables
*
* @return
*/
public Dataset<Vegetable> setupData1() {
Object[] lst1 = new Object[]{"spinach", "green", true, true, false};
Object[] lst2 = new Object[]{"kale", "green", true, true, true};
Object[] lst3 = new Object[]{"peas", "green", false, true, true};
Object[] lst4 = new Object[]{"carrot", "orange", false, false, false};
Object[] lst5 = new Object[]{"lettuce", "green", true, false, true};
LinkedList<Vegetable> data = new LinkedList<Vegetable>();
data.addLast(new Vegetable(lst1));
data.addLast(new Vegetable(lst2));
data.addLast(new Vegetable(lst3));
data.addLast(new Vegetable(lst4));
data.addLast(new Vegetable(lst5));
LinkedList<String> atts = new LinkedList<String>();
atts.addLast("name");
atts.addLast("color");
atts.addLast("lowCarb");
atts.addLast("highFiber");
atts.addLast("likeToEat");
return new Dataset<Vegetable>(atts, data);
}
/**
* runs the tree generator and prints out the tree
*
* @param t
*/
public void testTreeLayer(Tester t) {
Dataset<Vegetable> data1 = this.setupData1();
TreeGenerator<Vegetable> tg = new TreeGenerator<Vegetable>(data1);
tg.buildClassifier("likeToEat");
tg.classifier.printNode("");
t.checkExpect(0 == 0);
}
/**
* main method runs tests
*
* @param args
*/
public static void main(String[] args) {
Tester.run(new TreeGeneratorTest());
}
}