Search in sources :

Example 26 with ITmfTimestamp

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());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) Test(org.junit.Test)

Example 27 with ITmfTimestamp

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);
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) Test(org.junit.Test)

Example 28 with ITmfTimestamp

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());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) Test(org.junit.Test)

Example 29 with ITmfTimestamp

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);
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) Test(org.junit.Test)

Example 30 with ITmfTimestamp

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());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) Test(org.junit.Test)

Aggregations

ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)162 Test (org.junit.Test)102 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)52 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)12 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)11 ITmfContext (org.eclipse.tracecompass.tmf.core.trace.ITmfContext)10 Point (org.eclipse.swt.graphics.Point)8 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)8 ArrayList (java.util.ArrayList)6 NonNull (org.eclipse.jdt.annotation.NonNull)5 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)5 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)5 CtfTmfTrace (org.eclipse.tracecompass.tmf.ctf.core.trace.CtfTmfTrace)5 IOException (java.io.IOException)4 IStatus (org.eclipse.core.runtime.IStatus)4 File (java.io.File)3 Path (java.nio.file.Path)3 HashSet (java.util.HashSet)3 CoreException (org.eclipse.core.runtime.CoreException)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3