a whole bunch of stuff
[ephemerata.git] / KezvhLib / src-junit / net / kezvh / collections / trees / TestTree.java
blobe19c7d9723f20e6be380e56cc4c531a09545f8dd
1 /**
3 */
4 package net.kezvh.collections.trees;
6 import junit.framework.Assert;
7 import junit.framework.TestCase;
9 import org.junit.Test;
11 /**
12 * @author afflux
15 public abstract class TestTree extends TestCase {
16 /**
17 * @param rootvalue initial root value
18 * @return a tree
20 protected abstract Tree<Integer> getTree(Integer rootvalue);
22 /**
25 @Test
26 public void testSomething() {
27 final Tree<Integer> tree = this.getTree(0);
28 final Tree<Integer> child = tree.addChild(1);
29 Assert.assertEquals((Integer) 1, child.value());
32 /**
35 @Test
36 public void testSomething2() {
37 final Tree<Integer> tree = this.getTree(0);
38 final Tree<Integer> child = tree.addChild(1);
39 Assert.assertEquals(2, tree.size());
40 Assert.assertEquals(1, child.size());
43 /**
46 @Test
47 public void testSomething3() {
48 final Tree<Integer> tree = this.getTree(0);
49 final Tree<Integer> child = tree.addChild(1);
50 final Tree<Integer> child2 = child.addChild(2);
51 Assert.assertEquals(3, tree.size());
52 Assert.assertEquals(2, child.size());
53 Assert.assertEquals(1, child2.size());
56 /**
59 @Test
60 public void testSomething4() {
61 final Tree<Integer> tree = this.getTree(0);
62 final Tree<Integer> child = tree.addChild(1);
63 final Tree<Integer> child2 = child.addChild(2);
64 final Tree<Integer> chlid3 = child2.addChild(3);
65 Assert.assertEquals(4, tree.size());
66 Assert.assertEquals(3, child.size());
67 Assert.assertEquals(2, child2.size());
68 Assert.assertEquals(1, chlid3.size());