Commit 63c1e9c2 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

semantic backbone tests are now in the good place

refs 822
parent a898b9ea
/*--------------------------------------------------------------------------+
$Id: AllTests.java 4272 2012-05-10 14:01:50Z mou $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.testing.ui;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import test.org.fortiss.af3.testing.ui.gcctest.CCodeEquivalenceTest;
import test.org.fortiss.af3.testing.ui.model_checker.ModelCheckerEquivalenceTest;
/**
* Index to all tests.
*
* @author ratiu
* @author $Author: mou $
* @version $Rev: 4272 $
* @ConQAT.Rating YELLOW Hash: 316A4D8ABD7604839E8F76B2F359FE62
*/
// @CodeFormatterOff
@RunWith(Suite.class)
@SuiteClasses({ CCodeEquivalenceTest.class, ModelCheckerEquivalenceTest.class })
// @CodeFormatterOn
public class AllTests {
// empty class
}
<!--
$Id: package.html 4236 2012-05-08 11:49:23Z hoelzl $
@version $Rev: 4236 $
@ConQAT.Rating YELLOW Hash: 66D37160C0F8E368609AC8D747A5316F
-->
<body>
This package contains tests for assuring the alignment of the simulator and C code generator.
</body>
......@@ -15,7 +15,7 @@ $Id: TestCasesGeneratorTest.java 4076 2012-04-29 19:27:27Z ratiu $
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package test.org.fortiss.af3.testing.ui;
package test.org.fortiss.af3.testing.ui.model_checker;
import static org.fortiss.af3.testing.utils.TestingModelElementFactory.createStateCoverage;
import static org.fortiss.af3.testing.utils.TestingModelElementFactory.createTestSuiteSpecification;
......@@ -60,10 +60,10 @@ import test.org.fortiss.af3.expression.evaluator.EvaluatorTestData;
* @author ratiu
* @author $Author: ratiu $
* @version $Rev: 4076 $
* @ConQAT.Rating YELLOW Hash: 76E1E98574A3E0CFDA45E4CC808C9153
* @ConQAT.Rating YELLOW Hash: 013D86604FF9F234AB493485A9186CD1
*/
@RunWith(Parameterized.class)
public class SemanticBackboneTest extends ModelCheckerAnalysesTestBase {
public class ModelCheckerEquivalenceTest extends ModelCheckerAnalysesTestBase {
/** The component on which the tests are run. */
private Component current;
......@@ -72,10 +72,10 @@ public class SemanticBackboneTest extends ModelCheckerAnalysesTestBase {
private ModelCheckingTestSuiteGenerator gen;
/** Constructor. */
public SemanticBackboneTest(Component current) {
public ModelCheckerEquivalenceTest(Component current) {
this.current = current;
ModelCheckerConfig config = new ModelCheckerConfig(-100, 100);
ModelCheckerConfig config = new ModelCheckerConfig(-1000, 1000);
TestSuiteSpecification spec = createTestSuiteSpecification();
StateCoverage specPart = createStateCoverage(spec);
......@@ -90,7 +90,10 @@ public class SemanticBackboneTest extends ModelCheckerAnalysesTestBase {
public static Collection<Component[]> testDataCollection() {
String[] fileNames = {
"platform:/plugin/org.fortiss.af3.analyses/test-data/ModelCheckerBasicTests.af3_20",
"platform:/plugin/org.fortiss.af3.rcp.application/test-data/ACC.af3_20" };
"platform:/plugin/org.fortiss.af3.rcp.application/test-data/ACC.af3_20",
"platform:/plugin/org.fortiss.af3.rcp.application/test-data/Pacemaker.af3_20",
// "platform:/plugin/org.fortiss.af3.testing.ui/test-data/ACC.af3_20",
"platform:/plugin/org.fortiss.af3.testing.ui/test-data/SimpleTrafficLightsExample.af3_20" };
List<Component> topmostComponents = new ArrayList<Component>();
......@@ -98,11 +101,6 @@ public class SemanticBackboneTest extends ModelCheckerAnalysesTestBase {
collectTopComponentsWithOutputPorts(topmostComponents, fileName);
}
// SimpleTrafficLightsStateAutomatonExample tlc =
// SimpleTrafficLightsStateAutomatonExample.INSTANCE;
// collectTopComponentsWithOutputPorts(topmostComponents,
// tlc.createProject("TLC"));
return EvaluatorTestData.toListOfOneElementArrays(topmostComponents
.toArray(new Component[] {}));
}
......@@ -112,39 +110,38 @@ public class SemanticBackboneTest extends ModelCheckerAnalysesTestBase {
public void testSemanticsAlignment() {
ToolRunnerBase.DEBUG = true;
System.out
.println("############# Checking semantics alignment on component: "
+ current.getName());
System.out.println("### Checking semantics alignment on component: "
+ current.getName());
TestSuiteSpecification tss = createTestSuiteSpecification();
current.getSpecificationsList().add(tss);
TestSuite testSuite = null;
TestSuite suite = null;
try {
testSuite = gen.generate(tss, new NullProgressMonitor());
suite = gen.generate(tss, new NullProgressMonitor());
int stepsCount = 0;
for (TestCase tc : suite.getTestCasesList()) {
for (TestStep ts : tc.getTestStepsList()) {
stepsCount++;
for (TestOutput to : ts.getOutputsList()) {
ITerm expected = to.getExpectedValue();
ITerm simulated = to.getSimulatedValue();
assertEquals("Error with step " + stepsCount
+ " in component " + current.getName(),
expected, simulated);
}
}
}
System.out.println("### Successful run on "
+ suite.getTestCasesLength() + " test-cases and "
+ stepsCount + " test steps.");
} catch (Exception ex) {
ex.printStackTrace();
fail("Error occurred while processing component: "
+ current.getName());
}
int testSteps = 0;
for (TestCase tc : testSuite.getTestCasesList()) {
for (TestStep ts : tc.getTestStepsList()) {
testSteps++;
for (TestOutput to : ts.getOutputsList()) {
ITerm expected = to.getExpectedValue();
ITerm simulated = to.getSimulatedValue();
assertEquals("Error with step " + testSteps
+ " in component " + current.getName(), expected,
simulated);
}
}
}
System.out.println("############# Successful run on "
+ testSuite.getTestCasesLength() + " test-cases and "
+ testSteps + " test steps.");
ToolRunnerBase.DEBUG = false;
}
......
<!--
$Id: package.html 4236 2012-05-08 11:49:23Z hoelzl $
@version $Rev: 4236 $
@ConQAT.Rating YELLOW Hash: 173D2B48037D9F062231BF62B09DE3FA
-->
<body>
This package contains tests for assuring the alignment of the simulator and the model checker.
</body>
<!--
$Id: package.html 4236 2012-05-08 11:49:23Z hoelzl $
@version $Rev: 4236 $
@ConQAT.Rating YELLOW Hash: 9742578AA41D3CF0B785BD1A6684BCC4
-->
<body>
Base package for tests of the AF3 testing plugins.
</body>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment