ss: Enable StateSystemUtils tests
authorPatrick Tasse <patrick.tasse@gmail.com>
Wed, 25 Feb 2015 22:14:28 +0000 (17:14 -0500)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 26 Feb 2015 15:04:26 +0000 (10:04 -0500)
Also fix an incorrect test case and add a few more.

Change-Id: Ifa61814bc6d5b5e4395d072305e30f04a3a9b31a
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/42707
Reviewed-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/AllTests.java
org.eclipse.tracecompass.statesystem.core.tests/src/org/eclipse/tracecompass/statesystem/core/tests/StateSystemUtilsTest.java

index 5e6e2a4bbd5e9b0545630f3be007603de9f583f6..82e23a4f3b43fbc91a13b46fbd683555b1fb6c40 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2015 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -8,6 +8,7 @@
  *
  * Contributors:
  *   Alexandre Montplaisir - Initial API and implementation
+ *   Patrick Tasse - Enable StateSystemUtils tests
  *******************************************************************************/
 
 package org.eclipse.tracecompass.statesystem.core.tests;
@@ -21,6 +22,7 @@ import org.junit.runners.Suite;
 @RunWith(Suite.class)
 @Suite.SuiteClasses({
         StateSystemPushPopTest.class,
+        StateSystemUtilsTest.class,
         org.eclipse.tracecompass.statesystem.core.tests.backend.AllTests.class,
         org.eclipse.tracecompass.statesystem.core.tests.statevalue.AllTests.class
 })
index 4a01a01fd1490df0d674681ef6f21d49e8ea4db2..fe587e4212f04cd984082cea3bb26b4e14bfafd6 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 École Polytechnique de Montréal
+ * Copyright (c) 2014, 2015 École Polytechnique de Montréal
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -42,7 +42,6 @@ public class StateSystemUtilsTest {
 
     private static final long START_TIME = 1000L;
     private static final @NonNull String DUMMY_STRING = "test";
-    private static final int INT_VAL = 10;
 
     private ITmfStateSystemBuilder fStateSystem;
 
@@ -56,7 +55,7 @@ public class StateSystemUtilsTest {
             fStateSystem = StateSystemFactory.newStateSystem(DUMMY_STRING, backend);
             int quark = fStateSystem.getQuarkAbsoluteAndAdd(DUMMY_STRING);
 
-            fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(INT_VAL), quark);
+            fStateSystem.modifyAttribute(1200L, TmfStateValue.newValueInt(10), quark);
             fStateSystem.modifyAttribute(1500L, TmfStateValue.newValueInt(20), quark);
             fStateSystem.closeHistory(2000L);
         } catch (StateValueTypeException | AttributeNotFoundException e) {
@@ -101,15 +100,27 @@ public class StateSystemUtilsTest {
             ITmfStateInterval interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1000L, 1300L);
             assertNotNull(interval);
             assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
-            assertEquals(INT_VAL, interval.getStateValue().unboxInt());
+            assertEquals(10, interval.getStateValue().unboxInt());
 
             interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 800L, 2500L);
             assertNotNull(interval);
             assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
-            assertEquals(INT_VAL, interval.getStateValue().unboxInt());
+            assertEquals(10, interval.getStateValue().unboxInt());
 
-            interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1500L, 2500L);
-            assertNull(interval);
+            interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1300L, 1800L);
+            assertNotNull(interval);
+            assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+            assertEquals(10, interval.getStateValue().unboxInt());
+
+            interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1500L, 1800L);
+            assertNotNull(interval);
+            assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+            assertEquals(20, interval.getStateValue().unboxInt());
+
+            interval = StateSystemUtils.queryUntilNonNullValue(ss, quark, 1800L, 2500L);
+            assertNotNull(interval);
+            assertEquals(ITmfStateValue.Type.INTEGER, interval.getStateValue().getType());
+            assertEquals(20, interval.getStateValue().unboxInt());
 
         } catch (AttributeNotFoundException e) {
             fail(e.getMessage());
This page took 0.026658 seconds and 5 git commands to generate.