Search in sources :

Example 96 with CAddress

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

the class CBookmarkTest method testConstructor3.

@Test
public void testConstructor3() {
    final CBookmark bookmark = new CBookmark(new CAddress(BigInteger.valueOf(123)), "MyDescription");
    assertEquals(BigInteger.valueOf(123), bookmark.getAddress().toBigInteger());
    assertEquals("MyDescription", bookmark.getDescription());
}
Also used : CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 97 with CAddress

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

the class CBookmarkTest method testSetDescription.

@Test
public void testSetDescription() {
    final CBookmark bookmark = new CBookmark(new CAddress(BigInteger.valueOf(123)), "MyDescription");
    bookmark.setDescription("MySecondDescription");
    assertEquals("MySecondDescription", bookmark.getDescription());
}
Also used : CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 98 with CAddress

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

the class CModuleTest method test_C_Constructors.

@Test
public void test_C_Constructors() {
    try {
        new CModule(0, "Name", "Comment", new Date(), new Date(), md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    try {
        new CModule(1, null, "Comment", new Date(), new Date(), md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", null, new Date(), new Date(), md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", null, new Date(), md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), null, md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), null, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), "123456781234567812345678123456789", sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, null, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, "12345678123456781234567812345678123456789", 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, sha1, -1, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, sha1, 0, -1, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final IllegalArgumentException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, sha1, 0, 0, null, new CAddress(0), null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, sha1, 0, 0, new CAddress(0), null, null, null, Integer.MAX_VALUE, false, new MockSqlProvider());
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        new CModule(1, "Name", "Comment", new Date(), new Date(), md5, sha1, 0, 0, new CAddress(0), new CAddress(0), null, null, Integer.MAX_VALUE, false, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    final MockSqlProvider sql = new MockSqlProvider();
    final CModule module = new CModule(123, "Name", "Comment", new Date(), new Date(), md5, sha1, 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, sql), null, Integer.MAX_VALUE, false, sql);
    assertEquals(123, module.getConfiguration().getId());
    assertEquals("Name", module.getConfiguration().getName());
    assertEquals("Comment", module.getConfiguration().getDescription());
    assertEquals(md5, module.getConfiguration().getMD5());
    assertEquals(sha1, module.getConfiguration().getSha1());
    assertEquals(55, module.getFunctionCount());
    assertEquals(66, module.getCustomViewCount());
    assertEquals("00000555", module.getConfiguration().getFileBase().toHexString());
    assertEquals("00000666", module.getConfiguration().getImageBase().toHexString());
    assertEquals("Mock Debugger", module.getConfiguration().getDebuggerTemplate().getName());
    assertNotNull(module.getConfiguration().getDebugger());
    assertTrue(module.inSameDatabase(sql));
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 99 with CAddress

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

the class CModuleTest method testGetViewsWithAddresses.

@Test
public void testGetViewsWithAddresses() throws CouldntLoadDataException, LoadCancelledException {
    final FilledList<UnrelocatedAddress> addresses = new FilledList<UnrelocatedAddress>();
    addresses.add(new UnrelocatedAddress(new CAddress(12345678)));
    m_module.load();
    assertNotNull(m_module.getViewsWithAddresses(addresses, true));
}
Also used : FilledList(com.google.security.zynamics.zylib.types.lists.FilledList) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 100 with CAddress

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

the class SectionTests method getRawSizeTest2.

@Test
public void getRawSizeTest2() {
    final Section section = new Section(1, "SECTION1", commentManager, module, new CAddress("100", 16), new CAddress("200", 16), SectionPermission.READ, new byte[] { (byte) 0x90, (byte) 0xFF, (byte) 0x00 });
    Assert.assertEquals(3, section.getRawSize());
}
Also used : CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Aggregations

CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)315 Test (org.junit.Test)221 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)60 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)55 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)51 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)48 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)47 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)47 ArrayList (java.util.ArrayList)46 Date (java.util.Date)46 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)45 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)40 MemorySection (com.google.security.zynamics.binnavi.debug.models.processmanager.MemorySection)32 MemoryMap (com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryMap)29 MockView (com.google.security.zynamics.binnavi.disassembly.MockView)28 TargetProcessThread (com.google.security.zynamics.binnavi.debug.models.processmanager.TargetProcessThread)27 RelocatedAddress (com.google.security.zynamics.binnavi.disassembly.RelocatedAddress)27 CFunction (com.google.security.zynamics.binnavi.disassembly.CFunction)26 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)24 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)24