Example #1
0
  public static void testVisitation(ExecutionGraph graph, int[] expectedAddresses) {
    int[] addresses = graph.getAddresses();
    List<Integer> visitedAddresses = new LinkedList<Integer>();
    for (int address : addresses) {
      if (graph.wasAddressReached(address)) {
        visitedAddresses.add(address);
      }
    }
    int[] actualAddresses = Ints.toArray(visitedAddresses);
    Arrays.sort(expectedAddresses);
    Arrays.sort(actualAddresses);

    assertArrayEquals(expectedAddresses, actualAddresses);
  }
Example #2
0
 private static void testClassState(
     ExecutionGraph graph, Map<String, Map<String, HeapItem>> classNameToFieldDescriptorToItem) {
   for (Entry<String, Map<String, HeapItem>> fieldDescriptorMapEntry :
       classNameToFieldDescriptorToItem.entrySet()) {
     String className = fieldDescriptorMapEntry.getKey();
     VirtualClass virtualClass = graph.getVM().getClassManager().getVirtualClass(className);
     Map<String, HeapItem> fieldDescriptorToItem = fieldDescriptorMapEntry.getValue();
     for (Entry<String, HeapItem> entry : fieldDescriptorToItem.entrySet()) {
       String fieldDescriptor = entry.getKey();
       String fieldName = fieldDescriptor.split(":")[0];
       VirtualField field = virtualClass.getField(fieldName);
       HeapItem expected = entry.getValue();
       HeapItem actual = graph.getTerminatingFieldConsensus(field);
       testFieldEquals(expected, actual);
     }
   }
 }
Example #3
0
 private static void testRegisterState(
     ExecutionGraph graph, Map<Integer, HeapItem> registerToItem) {
   for (Entry<Integer, HeapItem> entry : registerToItem.entrySet()) {
     Integer register = entry.getKey();
     HeapItem expected = entry.getValue();
     HeapItem actual = graph.getTerminatingRegisterConsensus(register);
     testRegisterEquals(expected, actual);
   }
 }