1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.tests
.stateprovider
;
12 import static org
.junit
.Assert
.assertEquals
;
13 import static org
.junit
.Assert
.assertNotNull
;
15 import java
.util
.List
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import org
.eclipse
.tracecompass
.statesystem
.core
.ITmfStateSystem
;
19 import org
.eclipse
.tracecompass
.statesystem
.core
.exceptions
.StateSystemDisposedException
;
20 import org
.eclipse
.tracecompass
.statesystem
.core
.interval
.ITmfStateInterval
;
21 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.stateprovider
.XmlStateSystemModule
;
22 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.tests
.common
.TmfXmlTestFiles
;
23 import org
.eclipse
.tracecompass
.tmf
.analysis
.xml
.core
.tests
.module
.XmlUtilsTest
;
24 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfAnalysisException
;
25 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
26 import org
.junit
.Test
;
29 * Test Doubles in xml state system
31 * @author Matthew Khouzam
34 public class TmfXmlDoubleTest
{
36 private static final @NonNull String testTrace3
= "test_traces/testTrace3.xml";
39 * Test the state system on a double
41 * @throws TmfAnalysisException
42 * if it happens, we fail
43 * @throws StateSystemDisposedException
44 * if it happens, we fail
48 public void testConditionsValidation() throws TmfAnalysisException
, StateSystemDisposedException
{
49 ITmfTrace trace
= XmlUtilsTest
.initializeTrace(testTrace3
);
50 XmlStateSystemModule module
= XmlUtilsTest
.initializeModule(TmfXmlTestFiles
.DOUBLES_FILE
);
51 module
.setTrace(trace
);
54 module
.waitForCompletion();
56 ITmfStateSystem ss
= module
.getStateSystem();
58 List
<ITmfStateInterval
> val
= ss
.queryFullState(2);
59 assertEquals(3.141592, val
.get(0).getStateValue().unboxDouble(), Double
.MIN_VALUE
);
60 val
= ss
.queryFullState(4);
61 assertEquals(2.71828, val
.get(0).getStateValue().unboxDouble(), Double
.MIN_VALUE
);
62 val
= ss
.queryFullState(6);
63 assertEquals(1.41421, val
.get(0).getStateValue().unboxDouble(), Double
.MIN_VALUE
);