Search in sources :

Example 1 with CSpecialInstruction

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstruction in project binnavi by google.

the class CResultsTableModelTest method test1Simple.

@Test
public void test1Simple() {
    final CSpecialInstructionsModel foo = new CSpecialInstructionsModel();
    final List<CSpecialInstruction> instructions = new ArrayList<CSpecialInstruction>();
    final CCallsDescription callsDescription = new CCallsDescription();
    final CSpecialInstruction instruction = new CSpecialInstruction(callsDescription, new com.google.security.zynamics.binnavi.disassembly.MockInstruction());
    instructions.add(instruction);
    foo.setInstructions(instructions);
    final CResultsTableModel model = new CResultsTableModel(foo);
    assertEquals("Type", model.getColumnName(0));
    assertEquals("Address", model.getColumnName(1));
    assertEquals("Instruction", model.getColumnName(2));
    assertEquals(3, model.getColumnCount());
    assertEquals(1, model.getRowCount());
    final MockInstruction instruction2 = new MockInstruction();
    assertEquals(callsDescription, model.getValueAt(0, 0));
    assertEquals(instruction2.getAddress().toHexString(), model.getValueAt(0, 1));
    assertEquals(null, model.getValueAt(0, 2));
    model.dispose();
}
Also used : CSpecialInstructionsModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstructionsModel) CCallsDescription(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CCallsDescription) MockInstruction(com.google.security.zynamics.zylib.disassembly.MockInstruction) CSpecialInstruction(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstruction) CResultsTableModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CResultsTableModel) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with CSpecialInstruction

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstruction in project binnavi by google.

the class CSpecialInstructionsModelTest method test1Simple.

@Test
public void test1Simple() {
    final CSpecialInstructionsModel model = new CSpecialInstructionsModel();
    final List<CSpecialInstruction> instructions = new ArrayList<CSpecialInstruction>();
    final CCallsDescription callsDescription = new CCallsDescription();
    final CSpecialInstruction instruction = new CSpecialInstruction(callsDescription, new com.google.security.zynamics.binnavi.disassembly.MockInstruction());
    instructions.add(instruction);
    model.setInstructions(instructions);
    assertEquals(instruction, model.getInstruction(0));
    assertTrue((model.getDescriptions().get(0)) instanceof CCallsDescription);
    assertEquals("nop", model.getInstructions().get(0).getInstruction().getMnemonic());
    @SuppressWarnings("unused") final ISpecialInstructionsModelListener listener;
}
Also used : CSpecialInstructionsModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstructionsModel) CCallsDescription(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CCallsDescription) CSpecialInstruction(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstruction) ArrayList(java.util.ArrayList) ISpecialInstructionsModelListener(com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.ISpecialInstructionsModelListener) Test(org.junit.Test)

Aggregations

CCallsDescription (com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CCallsDescription)2 CSpecialInstruction (com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstruction)2 CSpecialInstructionsModel (com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CSpecialInstructionsModel)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 CResultsTableModel (com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.CResultsTableModel)1 ISpecialInstructionsModelListener (com.google.security.zynamics.binnavi.Gui.GraphWindows.BottomPanel.InstructionHighlighter.ISpecialInstructionsModelListener)1 MockInstruction (com.google.security.zynamics.zylib.disassembly.MockInstruction)1