use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class TraceLoggerTest method testStartErrors.
@Test
public void testStartErrors() throws CouldntSaveDataException, DebugExceptionWrapper {
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final IllegalArgumentException exception) {
}
m_mockDebugger.connect();
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start(null, "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", null, Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", null);
fail();
} catch (final NullPointerException exception) {
}
try {
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, null)));
fail();
} catch (final NullPointerException exception) {
}
@SuppressWarnings("unused") final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
try {
m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
fail();
} catch (final IllegalArgumentException exception) {
}
m_logger.stop();
try {
m_logger.stop();
fail();
} catch (final NullPointerException exception) {
}
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class TraceLoggerTest method testEmptyHits.
@Test
public void testEmptyHits() throws CouldntSaveDataException, DebugExceptionWrapper {
m_mockDebugger.connect();
final Trace trace = m_logger.start("Name", "Description", Lists.newArrayList(new TracePoint(m_mockModule, new Address(0x100))));
m_logger.stop();
assertEquals("Name", trace.getName());
assertEquals("Description", trace.getDescription());
assertTrue(trace.getEvents().isEmpty());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class AddressTest method testConstructor.
@Test
public void testConstructor() {
final Address address = new Address(0x123);
assertEquals(0x123, address.toLong());
assertEquals("123", address.toHexString());
assertEquals("123", address.toString());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class AddressTest method testPythonFunctions.
@Test
public void testPythonFunctions() {
final Address address1 = new Address(100);
final Address address2 = new Address(50);
assertEquals(100 + 50, address1.__add__(address2).toLong());
assertEquals(100 + 50, address1.__add__(50).toLong());
assertEquals(100 + 50, address1.__add__(BigInteger.valueOf(50)).toLong());
assertEquals(100 & 50, address1.__and__(address2).toLong());
assertFalse(address1.__eq__(address2));
assertTrue(address1.__eq__(100));
assertTrue(address1.__ge__(address2));
assertFalse(address1.__ge__(200));
assertTrue(address1.__gt__(address2));
assertFalse(address1.__gt__(address1));
assertFalse(address1.__le__(address2));
assertTrue(address1.__le__(address1));
assertFalse(address1.__lt__(address2));
assertTrue(address1.__lt__(200));
assertEquals(100, address1.__long__());
assertEquals(100 << 1, address1.__lshift__(1).toLong());
assertEquals(100 * 50, address1.__mul__(address2).toLong());
assertTrue(address1.__ne__(address2));
assertFalse(address1.__ne__(address1));
assertEquals(100 | 50, address1.__or__(address2).toLong());
assertEquals(100 + 50, address1.__radd__(address2).toLong());
assertEquals(100 & 50, address1.__rand__(address2).toLong());
assertEquals(100 * 50, address1.__rmul__(address2).toLong());
assertEquals(100 | 50, address1.__ror__(address2).toLong());
assertEquals(100 >> 1, address1.__rshift__(1).toLong());
assertEquals(-50, address1.__rsub__(address2).toLong());
assertEquals(50, address1.__sub__(address2).toLong());
assertEquals(100 ^ 50, address1.__xor__(address2).toLong());
assertEquals(100 ^ 50, address1.__rxor__(address2).toLong());
}
use of com.google.security.zynamics.binnavi.API.disassembly.Address in project binnavi by google.
the class BookmarkManagerTest method testGetBookmark.
@Test
public void testGetBookmark() {
try {
assertEquals(0x123, m_apiManager.getBookmark(null).getAddress().toLong());
} catch (final NullPointerException exception) {
}
assertNull(m_apiManager.getBookmark(new Address(0x123)));
m_apiManager.addBookmark(new Address(0x123), "Fark");
assertEquals(1, m_apiManager.getNumberOfBookmarks());
assertEquals(0x123, m_apiManager.getBookmark(new Address(0x123)).getAddress().toLong());
assertEquals("Fark", m_apiManager.getBookmark(new Address(0x123)).getDescription());
}
Aggregations