use of com.google.security.zynamics.binnavi.disassembly.MockOperandTreeNode in project binnavi by google.
the class TypeInstanceContainerTests method createReferenceTest5.
@Test
public void createReferenceTest5() throws CouldntLoadDataException, CouldntSaveDataException {
final int numberOfTypeInstances = typeInstanceContainer.getTypeInstances().size();
final TypeInstance typeInstance = typeInstanceContainer.createInstance("TYPEINSTANCE", null, baseType, section, 0);
Assert.assertEquals(numberOfTypeInstances + 1, typeInstanceContainer.getTypeInstances().size());
Assert.assertTrue(typeInstanceContainer.getTypeInstances().contains(typeInstance));
Assert.assertEquals(typeInstance, typeInstanceContainer.getTypeInstance(typeInstance.getAddress()));
expectedEvents.addedTypeInstance(typeInstance);
Assert.assertEquals(expectedEvents, listener);
Assert.assertEquals(0, typeInstanceContainer.getReferences(typeInstance).size());
final TypeInstanceReference typeInstanceReference = typeInstanceContainer.createReference(new CAddress("41000", 16), 0, new MockOperandTreeNode(), typeInstance, view);
Assert.assertNotNull(typeInstanceReference);
Assert.assertEquals(1, typeInstanceContainer.getReferences(typeInstance).size());
Assert.assertTrue(typeInstanceContainer.getReferences(typeInstance).contains(typeInstanceReference));
expectedEvents.addedTypeInstanceReference(typeInstanceReference);
Assert.assertEquals(expectedEvents, listener);
}
use of com.google.security.zynamics.binnavi.disassembly.MockOperandTreeNode in project binnavi by google.
the class TypeManagerDatabaseBackendTests method testUpdateTypeSubstitution.
@Test
public void testUpdateTypeSubstitution() throws CouldntSaveDataException, CouldntLoadDataException {
final MockOperandTreeNode node = new MockOperandTreeNode();
final BaseType baseType = backend.createType("test_type", 32, true, null, BaseTypeCategory.ATOMIC);
final BaseType newType = backend.createType("new_test_type", 32, true, null, BaseTypeCategory.ATOMIC);
final Integer newOffset = 64;
final TypeSubstitution substitution = backend.createTypeSubstitution(node, baseType, new ArrayList<Integer>(), 0, 32, new CAddress(0x1000));
backend.updateSubstitution(substitution, newType, new ArrayList<Integer>(), newOffset);
final RawTypeSubstitution updatedSubstitution = mockProvider.loadTypeSubstitution(mockModule, substitution.getAddress().toBigInteger(), substitution.getPosition(), substitution.getExpressionId());
Assert.assertEquals(newOffset, updatedSubstitution.getOffset());
Assert.assertEquals(newType.getId(), updatedSubstitution.getBaseTypeId());
}
use of com.google.security.zynamics.binnavi.disassembly.MockOperandTreeNode in project binnavi by google.
the class TypeManagerDatabaseBackendTests method testCreateTypeSubstitution.
@Test
public void testCreateTypeSubstitution() throws CouldntSaveDataException {
final CAddress address = new CAddress(0x1000);
final int position = 0;
final int offset = 32;
final MockOperandTreeNode node = new MockOperandTreeNode();
final BaseType baseType = backend.createType("test_type", 32, true, null, BaseTypeCategory.ATOMIC);
final TypeSubstitution substitution = backend.createTypeSubstitution(node, baseType, new ArrayList<Integer>(), position, offset, address);
Assert.assertEquals(node, substitution.getOperandTreeNode());
Assert.assertEquals(baseType, substitution.getBaseType());
Assert.assertEquals(position, substitution.getPosition());
Assert.assertEquals(offset, substitution.getOffset());
Assert.assertEquals(address, substitution.getAddress());
}
use of com.google.security.zynamics.binnavi.disassembly.MockOperandTreeNode in project binnavi by google.
the class OperandExpressionTest method testConstructor.
@Test
public void testConstructor() {
final MockOperandTreeNode node = new MockOperandTreeNode();
final OperandExpression expression = new OperandExpression(node);
assertEquals(ExpressionType.Register, expression.getType());
assertEquals("Mock Replacement", expression.getReplacement());
assertEquals("Mock Value", expression.toString());
}
Aggregations