Пример #1
0
  @Test
  public void testBlockSchedule() {
    ScheduleResult schedule =
        getFinalSchedule("testBlockScheduleSnippet", TestMode.WITHOUT_FRAMESTATES);
    StructuredGraph graph = schedule.getCFG().graph;
    NodeIterable<WriteNode> writeNodes = graph.getNodes().filter(WriteNode.class);

    assertDeepEquals(1, schedule.getCFG().getBlocks().size());
    assertDeepEquals(8, writeNodes.count());
    assertDeepEquals(1, graph.getNodes().filter(FloatingReadNode.class).count());

    FloatingReadNode read = graph.getNodes().filter(FloatingReadNode.class).first();

    WriteNode[] writes = new WriteNode[8];
    int i = 0;
    for (WriteNode n : writeNodes) {
      writes[i] = n;
      i++;
    }
    assertOrderedAfterSchedule(schedule, writes[4], read);
    assertOrderedAfterSchedule(schedule, read, writes[5]);
    for (int j = 0; j < 7; j++) {
      assertOrderedAfterSchedule(schedule, writes[j], writes[j + 1]);
    }
  }
Пример #2
0
 @Test
 public void test2() {
   StructuredGraph graph = parseAndProcess("test2Snippet");
   NodeIterable<MonitorExitNode> monitors = graph.getNodes(MonitorExitNode.class);
   Assert.assertEquals(1, monitors.count());
   Assert.assertEquals(monitors.first().stateAfter().bci, 3);
 }
Пример #3
0
 @Override
 protected boolean matchesSafely(NodeIterable<T> iterable, Description mismatchDescription) {
   mismatchDescription.appendText("is a NodeIterable that does not contain ").appendValue(node);
   return iterable.contains(node);
 }