Search in sources :

Example 11 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeRangeTest method testContainsRange.

@Test
public void testContainsRange() {
    final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(10);
    final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(20);
    final ITmfTimestamp ts3 = TmfTimestamp.fromSeconds(30);
    final ITmfTimestamp ts4 = TmfTimestamp.fromSeconds(40);
    final ITmfTimestamp ts5 = TmfTimestamp.fromSeconds(50);
    final ITmfTimestamp ts6 = TmfTimestamp.fromSeconds(60);
    final ITmfTimestamp ts7 = TmfTimestamp.fromSeconds(70);
    final ITmfTimestamp ts8 = TmfTimestamp.fromSeconds(80);
    // Reference range
    final TmfTimeRange range0 = new TmfTimeRange(ts3, ts6);
    // Start time below range
    final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
    final TmfTimeRange range2 = new TmfTimeRange(ts2, ts3);
    final TmfTimeRange range3 = new TmfTimeRange(ts2, ts4);
    final TmfTimeRange range4 = new TmfTimeRange(ts2, ts6);
    final TmfTimeRange range5 = new TmfTimeRange(ts2, ts7);
    assertFalse("contains", range0.contains(range1));
    assertFalse("contains", range0.contains(range2));
    assertFalse("contains", range0.contains(range3));
    assertFalse("contains", range0.contains(range4));
    assertFalse("contains", range0.contains(range5));
    // End time above range
    final TmfTimeRange range6 = new TmfTimeRange(ts3, ts7);
    final TmfTimeRange range7 = new TmfTimeRange(ts4, ts7);
    final TmfTimeRange range8 = new TmfTimeRange(ts6, ts7);
    final TmfTimeRange range9 = new TmfTimeRange(ts7, ts8);
    assertFalse("contains", range0.contains(range6));
    assertFalse("contains", range0.contains(range7));
    assertFalse("contains", range0.contains(range8));
    assertFalse("contains", range0.contains(range9));
    // Within range
    final TmfTimeRange range10 = new TmfTimeRange(ts3, ts4);
    final TmfTimeRange range11 = new TmfTimeRange(ts3, ts6);
    final TmfTimeRange range12 = new TmfTimeRange(ts4, ts5);
    final TmfTimeRange range13 = new TmfTimeRange(ts4, ts6);
    assertTrue("contains", range0.contains(range10));
    assertTrue("contains", range0.contains(range11));
    assertTrue("contains", range0.contains(range12));
    assertTrue("contains", range0.contains(range13));
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 12 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeRangeTest method testOpenRange2.

@Test
public void testOpenRange2() {
    final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
    final TmfTimeRange range = new TmfTimeRange(ts1, TmfTimestamp.BIG_CRUNCH);
    assertEquals("startTime", ts1, range.getStartTime());
    assertEquals("endTime", TmfTimestamp.BIG_CRUNCH, range.getEndTime());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 13 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeRangeTest method testEqualsBadType.

@Test
public void testEqualsBadType() {
    final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
    final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
    final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
    assertTrue("equals", !range1.equals(ts1));
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 14 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeRangeTest method testEqualsEndTime.

@Test
public void testEqualsEndTime() {
    final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
    final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
    final ITmfTimestamp ts3 = TmfTimestamp.fromSeconds(12355);
    final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
    final TmfTimeRange range2 = new TmfTimeRange(ts1, ts3);
    final TmfTimeRange range3 = new TmfTimeRange(ts2, ts3);
    assertTrue("equals", !range1.equals(range2));
    assertTrue("equals", !range1.equals(range3));
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Example 15 with TmfTimeRange

use of org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange in project tracecompass by tracecompass.

the class TmfTimeRangeTest method testHashCode.

// ------------------------------------------------------------------------
// hashCode
// ------------------------------------------------------------------------
@Test
public void testHashCode() {
    final ITmfTimestamp ts1 = TmfTimestamp.fromSeconds(12345);
    final ITmfTimestamp ts2 = TmfTimestamp.fromSeconds(12350);
    final TmfTimeRange range1 = new TmfTimeRange(ts1, ts2);
    final TmfTimeRange range1b = new TmfTimeRange(ts1, ts2);
    final TmfTimeRange range2 = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    final TmfTimeRange range2b = new TmfTimeRange(TmfTimestamp.BIG_BANG, TmfTimestamp.BIG_CRUNCH);
    assertTrue("hashCode", range1.hashCode() == range1b.hashCode());
    assertTrue("hashCode", range2.hashCode() == range2b.hashCode());
    assertTrue("hashCode", range1.hashCode() != range2.hashCode());
}
Also used : ITmfTimestamp(org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) Test(org.junit.Test)

Aggregations

TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)168 Test (org.junit.Test)98 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)53 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)29 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)24 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)24 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)21 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)20 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)19 ITmfEventRequest (org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest)16 SWTBotTimeGraph (org.eclipse.tracecompass.tmf.ui.swtbot.tests.shared.SWTBotTimeGraph)16 Vector (java.util.Vector)13 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)12 TmfTraceManager (org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager)10 ITmfEventProvider (org.eclipse.tracecompass.tmf.core.component.ITmfEventProvider)9 AbstractTimeGraphView (org.eclipse.tracecompass.tmf.ui.views.timegraph.AbstractTimeGraphView)9 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)8 TmfExperiment (org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment)8 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)8 Point (org.eclipse.swt.graphics.Point)7