use of org.eclipse.tracecompass.internal.tmf.core.synchronization.TmfConstantTransform in project tracecompass by tracecompass.
the class TsTransformTest method testEqualityConstantTransform.
/**
* Test the equality of {@link TmfConstantTransform} objects.
*/
@Test
public void testEqualityConstantTransform() {
ITmfTimestampTransform tt1 = new TmfConstantTransform(50L);
ITmfTimestampTransform tt2 = new TmfConstantTransform(50L);
ITmfTimestampTransform tt3 = new TmfConstantTransform(-10L);
assertEquals(tt1, tt2);
assertNotEquals(tt1, tt3);
assertNotEquals(tt2, tt3);
}
use of org.eclipse.tracecompass.internal.tmf.core.synchronization.TmfConstantTransform in project tracecompass by tracecompass.
the class TsTransformFactoryTest method transformIdentity.
/**
* Test with identity
*/
@Test
public void transformIdentity() {
final ITmfTimestampTransform identity = TimestampTransformFactory.createWithOffset(0);
final ITmfTimestampTransform innefficientIdentity = new TmfConstantTransform();
final ITmfTimestampTransform compositeInnefficientIdentity = identity.composeWith(innefficientIdentity);
final ITmfTimestampTransform compositeInnefficientIdentity2 = innefficientIdentity.composeWith(innefficientIdentity);
final ITmfTimestampTransform compositeInnefficientIdentity3 = innefficientIdentity.composeWith(identity);
assertEquals(t0, identity.transform(t0));
assertEquals(tn0, identity.transform(tn0));
assertEquals(t100, identity.transform(t100));
assertEquals(t1e2, identity.transform(t100));
assertEquals(t1e2, identity.transform(t1e2));
assertEquals(t1e3, identity.transform(t1e3));
assertEquals(tn100, identity.transform(tn100));
// bad practice
assertEquals(t0, innefficientIdentity.transform(t0));
// bad
assertEquals(t0, compositeInnefficientIdentity.transform(t0));
// practice
// bad
assertEquals(t0, compositeInnefficientIdentity2.transform(t0));
// practice
// bad
assertEquals(t0, compositeInnefficientIdentity3.transform(t0));
// practice
}
Aggregations