ss: Move selectNextChildren to CoreNode and return sequenceNumber
[deliverable/tracecompass.git] / statesystem / org.eclipse.tracecompass.statesystem.core.tests / stubs / org / eclipse / tracecompass / statesystem / core / tests / stubs / backend / HistoryTreeClassicStub.java
index 99a08f21560405e7c3c940035168f27a8d98aee6..2508db537491dd9228a782a0d41288f3bf8fef29 100644 (file)
@@ -18,6 +18,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.channels.ClosedChannelException;
+import java.util.Collection;
 import java.util.List;
 
 import org.eclipse.tracecompass.internal.statesystem.core.Activator;
@@ -257,6 +258,7 @@ public class HistoryTreeClassicStub extends HistoryTreeClassic {
                     assertTrue("Child at index " + i + " of parent " + node.getSequenceNumber() + " has correct start time",
                             childNode.getNodeEnd() <= childNode.getNodeEnd());
                 }
+                testIntersectingChildren(node, childNode);
             }
 
         } catch (ClosedChannelException e) {
@@ -264,4 +266,15 @@ public class HistoryTreeClassicStub extends HistoryTreeClassic {
         }
     }
 
+    private static void testIntersectingChildren(ParentNode parent, HTNode child) {
+        int childSequence = child.getSequenceNumber();
+        boolean shouldBeInCollection;
+        Collection<Integer> nextChildren;
+        for (long t = parent.getNodeStart(); t < parent.getNodeEnd(); t++) {
+            shouldBeInCollection = (t >= child.getNodeStart() && t <= child.getNodeEnd());
+            nextChildren = parent.selectNextChildren(t);
+            assertEquals(shouldBeInCollection, nextChildren.contains(childSequence));
+        }
+    }
+
 }
This page took 0.023787 seconds and 5 git commands to generate.