Author: jbeard
Date: Sat Jun 26 17:24:35 2010
New Revision: 958250
URL: http://svn.apache.org/viewvc?rev=958250&view=rev
Log:
Created new test for In predicate.
Added:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml
(with props)
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
(with props)
Modified:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js
Modified: commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js
URL:
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js?rev=958250&r1=958249&r2=958250&view=diff
==============================================================================
--- commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js (original)
+++ commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/build.js Sat Jun 26
17:24:35 2010
@@ -73,11 +73,14 @@ require.def("build",
//paths to all of the SCXML files we want to compile
var scxmlTests = {
+/*
KitchenSink
:"test/kitchen_sink/KitchenSink.xml",
KitchenSink_performance
:"test/kitchen_sink/KitchenSink_performance.xml",
KitchenSink_executableContent
:"test/kitchen_sink/KitchenSink_executableContent.xml",
ConditionalTransition
:"test/conditional_transition/TestConditionalTransition.xml",
- ConditionalTransition_executableContent
:"test/conditional_transition/TestConditionalTransition_executableContent.xml"
+ ConditionalTransition_executableContent
:"test/conditional_transition/TestConditionalTransition_executableContent.xml",
+*/
+ InPredicate
:"test/in_predicate/TestInPredicate.xml"
}
//FIXME: this violates Don't Repeat Yourself; these
paths are written here and in the module
@@ -104,10 +107,12 @@ require.def("build",
var unitTestScripts = [
+/*
"test/kitchen_sink/scripts/unitTest",
"test/kitchen_sink/scripts/unitTest_executableContent",
"test/conditional_transition/scripts/unitTest",
-
"test/conditional_transition/scripts/unitTest"
+*/
+ "test/in_predicate/scripts/unitTest.js"
]
//gets populated at run-time
Added:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml
URL:
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml?rev=958250&view=auto
==============================================================================
---
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml
(added)
+++
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml
Sat Jun 26 17:24:35 2010
@@ -0,0 +1,113 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+-->
+<!--
+This is to test the use of the In() predicate.
+-->
+<scxml
+ xmlns="http://www.w3.org/2005/07/scxml"
+ version="1.0"
+ profile="ecmascript">
+
+ <initial>
+ <transition target="p1"/>
+ </initial>
+
+ <parallel id="p1" initial="r1 r2">
+
+ <state id="r1" initial="a1">
+ <!-- sanity tests -->
+ <state id="a1">
+ <transition event="t1" target="b1"
cond="In(a1)"/>
+ </state>
+
+ <state id="b1">
+ <transition event="t2" target="c1"
cond="In(r1)"/>
+ </state>
+
+ <state id="c1">
+ <transition event="t3" target="d1"
cond="In(p1)"/>
+ </state>
+
+ <!-- tests for failure -->
+ <state id="d1">
+ <transition event="t4" target="e1"
cond="!In(e2)"/>
+ </state>
+
+ <state id="e1">
+ <transition event="t5" target="f1"
cond="!In(c2)"/>
+ </state>
+
+ <!-- tests for success -->
+ <state id="f1">
+ <transition event="t6" target="g1"
cond="In(a2)">
+ <send event="gen1"/>
+ </transition>
+ </state>
+
+ <state id="g1">
+ <transition event="t7" target="h1"
cond="In(b2)">
+ <send event="gen2"/>
+ </transition>
+ </state>
+
+ <state id="h1">
+ <transition event="t8" target="i1"
cond="In(c2)"/>
+ </state>
+
+ <state id="i1">
+ <transition event="t9" target="j1"
cond="In(d2)">
+ <send event="gen3"/>
+ </transition>
+ </state>
+
+ <state id="j1">
+ <transition event="t10" target="k1"
cond="In(e2)"/>
+ </state>
+
+ <state id="k1"/>
+
+ </state>
+
+ <state id="r2" initial="a2">
+ <state id="a2">
+ <transition event="gen1" target="b2"/>
+ </state>
+
+ <state id="b2">
+ <transition event="gen2" target="c2"/>
+ </state>
+
+ <state id="c2">
+ <initial>
+ <transition target="d2"/>
+ </initial>
+
+ <state id="d2">
+ <transition event="gen3" target="e2"/>
+ </state>
+
+ <state id="e2"/>
+ </state>
+ </state>
+
+ </parallel>
+
+</scxml>
+
+
+
Propchange:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/TestInPredicate.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
URL:
http://svn.apache.org/viewvc/commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js?rev=958250&view=auto
==============================================================================
---
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
(added)
+++
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
Sat Jun 26 17:24:35 2010
@@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+
+
+require.def( "test/conditional_transition/scripts/unitTest",
+{
+
+ scxmlTest : "test/in_predicate/TestInPredicate.xml",
+
+ register:function(scConstructor){
+
+ //TODO: can load this using RequireJS, so we don't need to use
the dojo module system?
+ dojo.require("doh.runner");
+ var sc;
+ doh.register("testConditionalTransitionSuite",[
+ {
+ name:"testAll",
+ //timeout:5000,
+ setUp:function(){
+ sc = new scConstructor()
+ sc.initialize();
+ },
+ runTest:function(){
+ var $ = function(conf){return
conf.map(function(s){return s.toString()})};
+
+ //sanity tests
+ var conf0 =
sc.getCurrentConfiguration();
+ console.log($(conf0));
+
doh.assertTrue(setwiseEqual(conf0,[sc._states.a1,sc._states.a2]));
+
+ console.info("sending event t1")
+ sc.t1()
+ var conf1 =
sc.getCurrentConfiguration();
+ console.log($(conf1));
+
doh.assertTrue(setwiseEqual(conf1,[sc._states.b1,sc._states.a2]));
+
+
+ console.info("sending event t2")
+ sc.t2()
+ var conf2 =
sc.getCurrentConfiguration();
+ console.log($(conf2));
+
doh.assertTrue(setwiseEqual(conf2,[sc._states.c1,sc._states.a2]));
+
+ //tests for failure
+ console.info("sending event t3")
+ sc.t3()
+ var conf3 =
sc.getCurrentConfiguration();
+ console.log($(conf3));
+
doh.assertTrue(setwiseEqual(conf3,[sc._states.d1,sc._states.a2]));
+
+ console.info("sending event t4")
+ sc.t4()
+ var conf4 =
sc.getCurrentConfiguration();
+ console.log($(conf4));
+
doh.assertTrue(setwiseEqual(conf4,[sc._states.e1,sc._states.a2]));
+
+ //tests for success
+ console.info("sending event t5")
+ sc.t5()
+ var conf5 =
sc.getCurrentConfiguration();
+ console.log($(conf5));
+
doh.assertTrue(setwiseEqual(conf5,[sc._states.f1,sc._states.a2]));
+
+ console.info("sending event t6")
+ sc.t6()
+ var conf5 =
sc.getCurrentConfiguration();
+ console.log($(conf6));
+
doh.assertTrue(setwiseEqual(conf6,[sc._states.g1,sc._states.b2]));
+
+ console.info("sending event t7")
+ sc.t7()
+ var conf7 =
sc.getCurrentConfiguration();
+ console.log($(conf7));
+
doh.assertTrue(setwiseEqual(conf7,[sc._states.h1,sc._states.d2]));
+
+ console.info("sending event t8")
+ sc.t8()
+ var conf8 =
sc.getCurrentConfiguration();
+ console.log($(conf8));
+
doh.assertTrue(setwiseEqual(conf8,[sc._states.i1,sc._states.d2]));
+
+ console.info("sending event t9")
+ sc.t9()
+ var conf9 =
sc.getCurrentConfiguration();
+ console.log($(conf9));
+
doh.assertTrue(setwiseEqual(conf9,[sc._states.j1,sc._states.e2]));
+
+ console.info("sending event
t10")
+ sc.t10()
+ var conf9 =
sc.getCurrentConfiguration();
+ console.log($(conf10));
+
doh.assertTrue(setwiseEqual(conf10,[sc._states.k1,sc._states.e2]));
+ },
+ tearDown:function(){
+ sc.destroy();
+ }
+ }
+ ]);
+ }
+})
+
+
Propchange:
commons/sandbox/gsoc/2010/scxml-js/branches/SCXML-140/test/in_predicate/scripts/unitTest.js
------------------------------------------------------------------------------
svn:eol-style = native