@Test public void mapTargetAddressNew() { smg1.addValue(value1); smg1.addObject(obj1); smg1.addPointsToEdge(edge1); destSMG.addObject(destObj); mapping1.map(obj1, destObj); SMGNodeMapping origMapping1 = new SMGNodeMapping(mapping1); SMGNodeMapping origMapping2 = new SMGNodeMapping(mapping2); SMG origDestSMG = new SMG(destSMG); SMGJoinMapTargetAddress mta = new SMGJoinMapTargetAddress(smg1, null, destSMG, mapping1, mapping2, value1, value2); Assert.assertNotEquals(origDestSMG, mta.getSMG()); Assert.assertNotEquals(origMapping1, mta.getMapping1()); Assert.assertNotEquals(origMapping2, mta.getMapping2()); Assert.assertFalse(origDestSMG.getValues().contains(mta.getValue())); SMGEdgePointsTo newEdge = destSMG.getPointer(mta.getValue()); Assert.assertSame(destObj, newEdge.getObject()); Assert.assertEquals(0, newEdge.getOffset()); Assert.assertSame(mta.getValue(), mta.getMapping1().get(value1)); Assert.assertSame(mta.getValue(), mta.getMapping2().get(value2)); }
@Test public void mapTargetAddressExisting() { SMGEdgePointsTo destEdge = new SMGEdgePointsTo(destValue, destObj, 0); smg1.addValue(value1); smg1.addObject(obj1); smg1.addPointsToEdge(edge1); destSMG.addValue(destValue); destSMG.addObject(destObj); destSMG.addPointsToEdge(destEdge); mapping1.map(obj1, destObj); SMGNodeMapping origMapping1 = new SMGNodeMapping(mapping1); SMG origDestSMG = new SMG(destSMG); SMGJoinMapTargetAddress mta = new SMGJoinMapTargetAddress(smg1, null, destSMG, mapping1, null, value1, null); Assert.assertEquals(origDestSMG, mta.getSMG()); Assert.assertEquals(origMapping1, mta.getMapping1()); Assert.assertNull(mta.getMapping2()); Assert.assertSame(destValue, mta.getValue()); }