Search in sources :

Example 11 with MockAddress

use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.

the class CCodeBookmarkTableModelTest method test4getValueAtWorking.

@Test
public void test4getValueAtWorking() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    final MockAddress mock = new MockAddress();
    assertEquals("burzel", tableModel.getValueAt(0, 2));
    assertEquals(mock.toHexString(), tableModel.getValueAt(0, 1));
    assertEquals("Mock Module", tableModel.getValueAt(0, 0));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 12 with MockAddress

use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.

the class CCodeBookmarkTableModelTest method test6getColumnName.

@Test
public void test6getColumnName() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertEquals("Module", tableModel.getColumnName(0));
    assertEquals("Address", tableModel.getColumnName(1));
    assertEquals("Description", tableModel.getColumnName(2));
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 13 with MockAddress

use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.

the class CCodeBookmarkTableModelTest method test3setValueAtFail.

@Test
public void test3setValueAtFail() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertEquals("burzel", tableModel.getValueAt(0, 2));
    try {
        tableModel.setValueAt("working", 0, 1);
        fail();
    } catch (final IllegalArgumentException e) {
    }
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 14 with MockAddress

use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.

the class CCodeBookmarkTableModelTest method test7removeBookmarkWorking.

@Test
public void test7removeBookmarkWorking() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
    final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
    bookmarkManager.addBookmark(bookmark);
    assertEquals("burzel", tableModel.getValueAt(0, 2));
    tableModel.setValueAt("working", 0, 2);
    assertEquals(1, tableModel.getRowCount());
    assertEquals("working", tableModel.getValueAt(0, 2));
    bookmarkManager.removeBookmark(bookmark);
    assertEquals(0, tableModel.getRowCount());
}
Also used : CCodeBookmark(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark) CCodeBookmarkTableModel(com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel) CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Example 15 with MockAddress

use of com.google.security.zynamics.zylib.disassembly.MockAddress in project binnavi by google.

the class CBookmarkFunctionsTest method test1AddBookmark.

@Test
public void test1AddBookmark() {
    final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
    final MockAddress mockAddress = new MockAddress();
    final MockModule mockModule = new MockModule();
    assertEquals(0, bookmarkManager.size());
    CBookmarkFunctions.addBookmark(bookmarkManager, mockModule, mockAddress);
    assertEquals(1, bookmarkManager.size());
}
Also used : CCodeBookmarkManager(com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MockAddress(com.google.security.zynamics.zylib.disassembly.MockAddress) Test(org.junit.Test)

Aggregations

MockAddress (com.google.security.zynamics.zylib.disassembly.MockAddress)15 Test (org.junit.Test)15 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)12 CCodeBookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmarkManager)12 CCodeBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.CodeBookmarks.CCodeBookmarkTableModel)8 CCodeBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark)8 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)2 CBookmarkTableModel (com.google.security.zynamics.binnavi.Gui.Debug.Bookmarks.CBookmarkTableModel)2 DebugTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings)2 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)2 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)2 BookmarkManager (com.google.security.zynamics.binnavi.models.Bookmarks.memory.BookmarkManager)2 CBookmark (com.google.security.zynamics.binnavi.models.Bookmarks.memory.CBookmark)2 CProjectContainer (com.google.security.zynamics.binnavi.disassembly.CProjectContainer)1 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)1 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)1 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1 FilledList (com.google.security.zynamics.zylib.types.lists.FilledList)1 IFilledList (com.google.security.zynamics.zylib.types.lists.IFilledList)1 LinkedHashSet (java.util.LinkedHashSet)1