use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeNodeTest method setUp.
@Before
public void setUp() {
data = new StringBuilder("Object");
data2 = "Data";
s = "String";
t = new TreeNode(data, s, false);
child = new TreeNode(data2, true);
child2 = new TreeNode(data, s, false);
t.add(child);
t.add(child2);
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeNodeTest method testSortTree.
@Test
public void testSortTree() {
TreeNode child1 = new TreeNode("2", false);
t.add(child1);
TreeNode child2 = new TreeNode("1", false);
t.add(child2);
TreeNode child3 = new TreeNode("3", false);
t.add(child3);
t.sortTree();
assertEquals("Same number of children", 5, t.getChildCount());
assertEquals("Sorted first node correct", child2, t.getChildAt(0));
assertEquals("Sorted last node correct", child, t.getChildAt(3));
assertEquals("Sorted middle correct", child1, t.getChildAt(1));
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeNodeTest method testRemoveAll.
@Test
public void testRemoveAll() {
t.add(new TreeNode("Child", false));
assertTrue(t.removeAll());
assertEquals("No children", 0, t.getChildCount());
assertTrue(t.removeAll());
assertEquals("Still no children", 0, t.getChildCount());
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeNodeTest method testSortLevel.
@Test
public void testSortLevel() {
TreeNode child1 = new TreeNode("2", false);
t.add(child1);
TreeNode child2 = new TreeNode("1", false);
t.add(child2);
TreeNode child3 = new TreeNode("3", false);
t.add(child3);
t.sortLevel();
assertEquals("Same number of children", 5, t.getChildCount());
assertEquals("Sorted first node correct", child2, t.getChildAt(0));
assertEquals("Sorted last node correct", child, t.getChildAt(3));
assertEquals("Sorted middle correct", child1, t.getChildAt(1));
}
use of org.eclipse.linuxtools.systemtap.structures.TreeNode in project linuxtools by eclipse.
the class TreeSettingsTest method testGetTreeFileDate.
@Test
public void testGetTreeFileDate() {
long d1 = TreeSettings.getTreeFileDate();
long d2 = TreeSettings.getTreeFileDate();
assertEquals("TreeDate same", d1, d2);
TreeSettings.setTrees(new TreeNode("f", false), new TreeNode("p", false));
d2 = TreeSettings.getTreeFileDate();
assertTrue("TreeDate changed", d1 < d2);
}
Aggregations