public void verify_second_child_added() { var ipRoot = new UIntPtr(1); ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); // Add first child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(2), 1, 1)); // Add second child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(3), 1, 1)); Assert.AreEqual(2, rootProfileNode.Children.Count); }
public void verify_second_child_added_has_correct_Depth() { var ipRoot = new UIntPtr(1); ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); // Add first child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(2), 1, 1)); const int EXPECTED_DEPTH = 6; // Add second child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(11), 1, EXPECTED_DEPTH)); Assert.AreEqual(EXPECTED_DEPTH, GetProfileNodeChildByIndex(rootProfileNode, 1).Depth); }
public void verify_second_child_added_has_correct_CallCount() { var ipRoot = new UIntPtr(1); ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); // Add first child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(2), 1, 1)); const int EXPECTED_CALL_COUNT = 12; // Add second child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(11), EXPECTED_CALL_COUNT, 1)); Assert.AreEqual(EXPECTED_CALL_COUNT, GetProfileNodeChildByIndex(rootProfileNode, 1).RunnableCount); }
public void verify_second_child_added_has_correct_FunctionId() { var ipRoot = new UIntPtr(1); ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); // Add first child. rootProfileNode.AddChild(new ProfileNode(new UIntPtr(2), 1, 1)); const int IP_CHILD_VALUE = 175275300; var ipExpected = new UIntPtr(IP_CHILD_VALUE); var ipChild = new UIntPtr(IP_CHILD_VALUE); // Add second child. rootProfileNode.AddChild(new ProfileNode(ipChild, 1, 1)); Assert.AreEqual(ipExpected, GetProfileNodeChildByIndex(rootProfileNode, 1).FunctionId); }
private void UpdateTree(ProfileNode parent, UIntPtr[] fids, int fidIndex, uint depth) { if (fidIndex < 0) { return; } var fid = fids[fidIndex]; var child = parent.Children .Where(node => node != null) .Where(node => node.FunctionId == fid) .FirstOrDefault(); if (child != null) { child.RunnableCount++; } else { // If no matching child found, create a new one to recurse into child = new ProfileNode(fid, 1, depth); parent.AddChild(child); // If we just added this node's only child, add it to the pruning list if (parent.Children.Count == 1) { _service.AddNodeToPruningList(child); } } UpdateTree(child, fids, fidIndex - 1, ++depth); }
public void verify_first_child_added() { var ipTest = new UIntPtr(20); ProfileNode node = new ProfileNode(new UIntPtr(), 1, 0); node.AddChild(new ProfileNode(ipTest, 1, 0)); Assert.AreEqual(1, node.Children.Count); }
public void verify_first_child_added_has_correct_Depth_value() { var ipRoot = new UIntPtr(1); const int EXPECTED_DEPTH_VALUE = 2; ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); rootProfileNode.AddChild(new ProfileNode(new UIntPtr(1), 1, EXPECTED_DEPTH_VALUE)); Assert.AreEqual(EXPECTED_DEPTH_VALUE, GetProfileNodeChildByIndex(rootProfileNode, 0).Depth); }
public void verify_first_child_added_has_correct_CallCount_value() { var ipRoot = new UIntPtr(1); const int EXPECTED_CALL_COUNT = 12; ProfileNode rootProfileNode = new ProfileNode(ipRoot, 0, 0); rootProfileNode.AddChild(new ProfileNode(new UIntPtr(1), EXPECTED_CALL_COUNT, 1)); Assert.AreEqual(EXPECTED_CALL_COUNT, GetProfileNodeChildByIndex(rootProfileNode, 0).RunnableCount); }
public void verify_grandchild_added() { var ipRoot = new UIntPtr(1); ProfileNode rootProfileNode = new ProfileNode(ipRoot, 1, 0); // Add first child. ProfileNode child = new ProfileNode(new UIntPtr(2), 1, 1); rootProfileNode.AddChild(child); // Add grandchild. child.AddChild(new ProfileNode(new UIntPtr(3), 1, 1)); Assert.AreEqual(1, GetProfileNodeChildByIndex(rootProfileNode, 0).Children.Count); }