use of org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp in project tracecompass by tracecompass.
the class TmfTimestampTest method testNormalizeZeroScale.
@Test
public void testNormalizeZeroScale() {
ITmfTimestamp ts = ts0.normalize(0, 10);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 0, ts.getScale());
ts = ts0.normalize(0, -10);
assertEquals("getValue", 0, ts.getValue());
assertEquals("getscale", 0, ts.getScale());
}
use of org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp in project tracecompass by tracecompass.
the class TmfTimestampTest method testCompareToCornerCases2.
@Test
public void testCompareToCornerCases2() {
final ITmfTimestamp ts0a = TmfTimestamp.create(Long.MAX_VALUE, Integer.MAX_VALUE - 1);
final ITmfTimestamp ts0b = TmfTimestamp.create(0, Integer.MAX_VALUE);
final ITmfTimestamp ts0c = TmfTimestamp.create(Long.MAX_VALUE, Integer.MAX_VALUE);
assertTrue("compareTo", ts0a.compareTo(ts0b) > 0);
assertTrue("compareTo", ts0a.compareTo(ts0c) < 0);
assertTrue("compareTo", ts0b.compareTo(ts0a) < 0);
assertTrue("compareTo", ts0b.compareTo(ts0c) < 0);
assertTrue("compareTo", ts0c.compareTo(ts0a) > 0);
assertTrue("compareTo", ts0c.compareTo(ts0b) > 0);
}
use of org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp in project tracecompass by tracecompass.
the class TmfTimestampTest method testNormalizeOffsetAndScale2.
@Test
public void testNormalizeOffsetAndScale2() {
int SCALE = 2;
ITmfTimestamp ts = ts1.normalize(0, SCALE);
assertEquals("getValue", 123, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
ts = ts1.normalize(12345, SCALE);
assertEquals("getValue", 12468, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
SCALE = -2;
ts = ts1.normalize(0, SCALE);
assertEquals("getValue", 1234500, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
ts = ts1.normalize(67, SCALE);
assertEquals("getValue", 1234567, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
}
use of org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp in project tracecompass by tracecompass.
the class TmfTimestampTest method testEqualsSymmetry.
@Test
public void testEqualsSymmetry() {
final ITmfTimestamp ts0copy = TmfTimestamp.create(ts0.getValue(), ts0.getScale());
assertEquals("equals", ts0, ts0copy);
assertEquals("equals", ts0copy, ts0);
final ITmfTimestamp ts1copy = TmfTimestamp.create(ts1.getValue(), ts1.getScale());
assertEquals("equals", ts1, ts1copy);
assertEquals("equals", ts1copy, ts1);
final ITmfTimestamp ts2copy = TmfTimestamp.create(ts2.getValue(), ts2.getScale());
assertEquals("equals", ts2, ts2copy);
assertEquals("equals", ts2copy, ts2);
}
use of org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp in project tracecompass by tracecompass.
the class TmfTimestampTest method testNormalizeOffsetAndScale.
@Test
public void testNormalizeOffsetAndScale() {
final int SCALE = 12;
ITmfTimestamp ts = ts1.normalize(0, SCALE);
assertEquals("getValue", 0, ts.getValue());
// zeroed
assertEquals("getscale", 0, ts.getScale());
ts = ts1.normalize(12345, SCALE);
assertEquals("getValue", 12345, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
ts = ts1.normalize(10, SCALE);
assertEquals("getValue", 10, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
ts = ts1.normalize(-10, SCALE);
assertEquals("getValue", -10, ts.getValue());
assertEquals("getscale", SCALE, ts.getScale());
}
Aggregations