]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
(refs #7365) Unit test for the bug 15/715/1
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 13 Jul 2017 11:56:46 +0000 (14:56 +0300)
committerHannu Niemistö <hannu.niemisto@semantum.fi>
Thu, 13 Jul 2017 11:57:24 +0000 (14:57 +0300)
"CHR constraint from an included ruleset is activated multiple times"

Change-Id: If24b6b3251ad563ccc8f9db9c97c71279f688325

tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ActiveTests.java
tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/CHR11.scl [new file with mode: 0644]

index c4d1c6f235f40f8758cc6570812b909b450e793a..4b9a3ffd2b48d8a5b20072c508926bfe324c6bfe 100644 (file)
@@ -19,4 +19,6 @@ public class ActiveTests extends TestBase {
   */  
     
     //@Test public void Bug6989() { test(); }
+    
+    @Test public void CHR11() { test(); }
 }
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/CHR11.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/CHR11.scl
new file mode 100644 (file)
index 0000000..3ba991e
--- /dev/null
@@ -0,0 +1,26 @@
+module { export = [main], features = [chr] }
+import "Prelude"
+
+ruleset Foo where
+    constraint Foo Integer
+
+main = ()
+  where
+    foo = createFoo
+    include Foo foo
+    
+    when Foo ?x
+    then print ?x
+    
+    when True
+    then Foo 2
+    
+    when Foo ?x
+         ?x < 5
+    then Foo (?x + 1)
+--
+2
+3
+4
+5
+()
\ No newline at end of file