use of com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater in project binnavi by google.
the class CVariableHighlighterTest method test1Simple.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final List<INaviInstruction> mockInstructions = new ArrayList<INaviInstruction>();
final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
final NaviNode naviNode = graph.getNode(node);
mockInstructions.add(Iterables.get(node.getInstructions(), 0));
final BackEndDebuggerProvider provider = new MockDebuggerProvider();
@SuppressWarnings("unused") final CCodeNodeUpdater updater = new CCodeNodeUpdater(graph, naviNode, node, provider);
assertFalse(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
CVariableHighlighter.highlightInstructions(graph, mockInstructions);
assertTrue(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
}
use of com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater in project binnavi by google.
the class CGraphSynchonizerTest method test1Simple.
// TODO this test is very artificial as it does not test a real work flow.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CSpecialInstructionsModel model = new CSpecialInstructionsModel();
final List<CSpecialInstruction> instructions = new ArrayList<CSpecialInstruction>();
final ITypeDescription callsDescription = model.getDescriptions().get(0);
callsDescription.setEnabled(true);
final CSpecialInstruction instruction = new CSpecialInstruction(callsDescription, Iterables.getFirst(graph.getRawView().getBasicBlocks().get(2).getInstructions(), null));
final CCodeNode node = graph.getRawView().getBasicBlocks().get(2);
final NaviNode naviNode = graph.getNode(node);
final BackEndDebuggerProvider provider = new MockDebuggerProvider();
new CCodeNodeUpdater(graph, naviNode, node, provider);
instructions.add(instruction);
model.setInstructions(instructions);
assertFalse(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.SPECIAL_INSTRUCTION_LAYER));
final CGraphSynchronizer synchronizer = new CGraphSynchronizer(graph, model);
CTypeResultsHighlighter.updateHighlighting(graph, Lists.newArrayList(instruction));
assertTrue(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.SPECIAL_INSTRUCTION_LAYER));
synchronizer.dispose();
}
Aggregations