From c74bd63fdd1e264236d87c1c0d579f43d8b4048b Mon Sep 17 00:00:00 2001 From: Niklas Dewally Date: Fri, 11 Oct 2024 16:29:25 +0100 Subject: [PATCH] add test for partial evaluation of or, and --- .../partial-eval-or-and/config.toml | 1 + .../partial-eval-or-and/input.eprime | 8 ++ .../input.expected-minion.solutions.json | 17 +++ .../input.expected-parse.serialised.json | 124 ++++++++++++++++++ .../input.expected-rewrite.serialised.json | 91 +++++++++++++ 5 files changed, 241 insertions(+) create mode 100644 conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/config.toml create mode 100644 conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.eprime create mode 100644 conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-minion.solutions.json create mode 100644 conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-parse.serialised.json create mode 100644 conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-rewrite.serialised.json diff --git a/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/config.toml b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/config.toml new file mode 100644 index 0000000000..aba59830c1 --- /dev/null +++ b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/config.toml @@ -0,0 +1 @@ +extra_rewriter_asserts=["vector_operators_have_partially_evaluated"] diff --git a/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.eprime b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.eprime new file mode 100644 index 0000000000..c69f546a71 --- /dev/null +++ b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.eprime @@ -0,0 +1,8 @@ +language ESSENCE' 1.0 + +find a,b,c : bool such that + +a \/ b \/ false, +$ this alldiff should not end up in the final model +allDiff([1,2,3]) \/ true, +(c /\ true) diff --git a/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-minion.solutions.json b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-minion.solutions.json new file mode 100644 index 0000000000..2357b354e3 --- /dev/null +++ b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-minion.solutions.json @@ -0,0 +1,17 @@ +[ + { + "UserName(a)": 0, + "UserName(b)": 1, + "UserName(c)": 1 + }, + { + "UserName(a)": 1, + "UserName(b)": 0, + "UserName(c)": 1 + }, + { + "UserName(a)": 1, + "UserName(b)": 1, + "UserName(c)": 1 + } +] \ No newline at end of file diff --git a/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-parse.serialised.json b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-parse.serialised.json new file mode 100644 index 0000000000..254436f7a4 --- /dev/null +++ b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-parse.serialised.json @@ -0,0 +1,124 @@ +{ + "constraints": { + "And": [ + { + "clean": false, + "etype": null + }, + [ + { + "Or": [ + { + "clean": false, + "etype": null + }, + [ + { + "Or": [ + { + "clean": false, + "etype": null + }, + [ + { + "Reference": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "a" + } + ] + }, + { + "Reference": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "b" + } + ] + } + ] + ] + }, + { + "Constant": [ + { + "clean": false, + "etype": null + }, + { + "Bool": false + } + ] + } + ] + ] + }, + { + "And": [ + { + "clean": false, + "etype": null + }, + [ + { + "Reference": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "c" + } + ] + }, + { + "Constant": [ + { + "clean": false, + "etype": null + }, + { + "Bool": true + } + ] + } + ] + ] + } + ] + ] + }, + "next_var": 0, + "variables": [ + [ + { + "UserName": "a" + }, + { + "domain": "BoolDomain" + } + ], + [ + { + "UserName": "b" + }, + { + "domain": "BoolDomain" + } + ], + [ + { + "UserName": "c" + }, + { + "domain": "BoolDomain" + } + ] + ] +} \ No newline at end of file diff --git a/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-rewrite.serialised.json b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-rewrite.serialised.json new file mode 100644 index 0000000000..aa28296e44 --- /dev/null +++ b/conjure_oxide/tests/integration/eprime-minion/partial-eval-or-and/input.expected-rewrite.serialised.json @@ -0,0 +1,91 @@ +{ + "constraints": { + "And": [ + { + "clean": false, + "etype": null + }, + [ + { + "Or": [ + { + "clean": false, + "etype": null + }, + [ + { + "WatchedLiteral": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "a" + }, + { + "Bool": true + } + ] + }, + { + "WatchedLiteral": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "b" + }, + { + "Bool": true + } + ] + } + ] + ] + }, + { + "WatchedLiteral": [ + { + "clean": false, + "etype": null + }, + { + "UserName": "c" + }, + { + "Bool": true + } + ] + } + ] + ] + }, + "next_var": 0, + "variables": [ + [ + { + "UserName": "a" + }, + { + "domain": "BoolDomain" + } + ], + [ + { + "UserName": "b" + }, + { + "domain": "BoolDomain" + } + ], + [ + { + "UserName": "c" + }, + { + "domain": "BoolDomain" + } + ] + ] +} \ No newline at end of file