From 1ed310d4abb7444048b899f27822ec29a0d35e94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Thu, 13 Jul 2017 14:56:46 +0300 Subject: [PATCH] (refs #7365) Unit test for the bug "CHR constraint from an included ruleset is activated multiple times" Change-Id: If24b6b3251ad563ccc8f9db9c97c71279f688325 --- .../scl/compiler/tests/ActiveTests.java | 2 ++ .../scl/compiler/tests/scl/CHR11.scl | 26 +++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/CHR11.scl diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ActiveTests.java b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ActiveTests.java index c4d1c6f23..4b9a3ffd2 100644 --- a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ActiveTests.java +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ActiveTests.java @@ -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 index 000000000..3ba991ef5 --- /dev/null +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/CHR11.scl @@ -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 -- 2.43.2