public int[] getConnectedTerminatingAddresses() { TIntList addresses = new TIntLinkedList(); for (int address : terminatingAddresses) { if (wasAddressReached(address)) { addresses.add(address); } } return addresses.toArray(); }
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); }
private static void testException(String methodDescriptor, Class<?> exceptionClass, String exceptionMessage, VMState initial) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor, initial); HeapItem item = graph.getTerminatingRegisterConsensus(0); Assert.assertEquals(exceptionClass, item.getValue().getClass()); Assert.assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); Assert.assertEquals(exceptionMessage, ((Throwable) item.getValue()).getMessage()); assertFalse("Should not reach next instruction in non-exception execution path", graph.wasAddressReached(1)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); Assert.assertEquals(0, mState.getRegistersAssigned().length); }
private static void testException(String methodDescriptor, Class<?> exceptionClass, String exceptionMessage, VMState initial) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor, initial); HeapItem item = graph.getTerminatingRegisterConsensus(0); Assert.assertEquals(exceptionClass, item.getValue().getClass()); Assert.assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); Assert.assertEquals(exceptionMessage, ((Throwable) item.getValue()).getMessage()); assertFalse("Should not reach next instruction in non-exception execution path", graph.wasAddressReached(1)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); Assert.assertEquals(0, mState.getRegistersAssigned().length); }
private static void testException(String methodDescriptor, Class<?> exceptionClass, String exceptionMessage, VMState initial) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor, initial); HeapItem item = graph.getTerminatingRegisterConsensus(0); Assert.assertEquals(exceptionClass, item.getValue().getClass()); Assert.assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); Assert.assertEquals(exceptionMessage, ((Throwable) item.getValue()).getMessage()); assertFalse("Should not reach next instruction in non-exception execution path", graph.wasAddressReached(1)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); Assert.assertEquals(0, mState.getRegistersAssigned().length); }
private static void testException(String methodDescriptor, Class<?> exceptionClass, VMState initial) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor, initial); HeapItem item = graph.getTerminatingRegisterConsensus(0); assertEquals(exceptionClass, item.getValue().getClass()); assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); assertFalse("Should not reach next instruction in non-exception execution path", graph.wasAddressReached(2)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); assertEquals(0, mState.getRegistersAssigned().length); }
private static void testException(String methodDescriptor, Class<?> exceptionClass, VMState initial) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor, initial); HeapItem item = graph.getTerminatingRegisterConsensus(0); Assert.assertEquals(exceptionClass, item.getValue().getClass()); Assert.assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); assertFalse("Should not reach next instruction in non-exception execution path", graph.wasAddressReached(2)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); Assert.assertEquals(0, mState.getRegistersAssigned().length); }
private static void testException(String methodDescriptor, Class<?> exceptionClass) { ExecutionGraph graph = VMTester.execute(CLASS_NAME, methodDescriptor); HeapItem item = graph.getTerminatingRegisterConsensus(0); assertEquals(exceptionClass, item.getValue().getClass()); assertEquals(ClassNameUtils.toInternal(exceptionClass), item.getType()); assertFalse(graph.wasAddressReached(2)); MethodState mState = graph.getNodePile(0).get(0).getContext().getMethodState(); assertEquals(0, mState.getRegistersAssigned().length); }