From 1344cb41b8612971d9fd42daae4542315c98d9af Mon Sep 17 00:00:00 2001 From: StrayAlien Date: Sat, 24 Jun 2023 09:07:49 +1000 Subject: [PATCH] 1146-feel-context-put-function --- ...1146-feel-context-put-function-test-01.xml | 412 ++++++++++++++++++ .../1146-feel-context-put-function.dmn | 310 +++++++++++++ 2 files changed, 722 insertions(+) create mode 100644 TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function-test-01.xml create mode 100644 TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function.dmn diff --git a/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function-test-01.xml b/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function-test-01.xml new file mode 100644 index 00000000..90a23c8e --- /dev/null +++ b/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function-test-01.xml @@ -0,0 +1,412 @@ + + + + 1146-feel-context-put-function.dmn + + + + + + + + Will add context entry + + + + 1 + + + + + + + Will add entry to end of context + + + + + + a + + + 1 + + + + + b + + + 2 + + + + + + + + + Will overwrite existing context entry + + + + 2 + + + + + + + Will maintain key order when overwriting existing context entry + + + + 1 + + + 3 + + + 3 + + + + + + + Will permit empty key param + + + + 1 + + + + + + + Null key param gives null + + + + + + + + + Null context param gives null + + + + + + + + + Will permit null value param + + + + + + + + + + + Too few params gives null + + + + + + + + + Too many params gives null + + + + + + + + + named params + + + + 1 + + + + + + + Incorrect named param gives null + + + + + + + + + Incorrect 'context' type gives null + + + + + + + + + Will return null when key is not a string + + + + + + + + + Will operate on boxed context + + + + 2 + + + + + + + Will create new copy of boxed context, not mutate it + + + + + + 1 + + + + + + 2 + + + + + + + + Will create new copy of literal context, not mutate it + + + + + + 1 + + + + + + 2 + + + + + + + + will overwrite value in nested context + + + + 1 + + + + 2 + + + + + + + + will add value to nested context + + + + 1 + + + + 0 + + + 2 + + + + + + + + null key gives null (1) + + + + + + + + + null key gives null (2) + + + + + + + + + null key gives null (3) + + + + + + + + + empty keys array gives null + + + + + + + + + will recurse into nested contexts + + + + 1 + + + + + + 2 + + + + + + + + + + named params - with 'keys' + + + + 1 + + + + 2 + + + + + + + + named params - array value for 'key' gives null + + + + + + + + + named params - array value for 'key' gives null + + + + + + + + + Will operate on boxed context + + + + + 2 + + + + + + + + Will create new copy of nested boxed context, not mutate it + + + + + + + 1 + + + + + + + + 2 + + + + + + + + + Will create new copy of nested literal context, not mutate it + + + + + + + 1 + + + + + + + + 2 + + + + + + + + diff --git a/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function.dmn b/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function.dmn new file mode 100644 index 00000000..73fc3fd2 --- /dev/null +++ b/TestCases/compliance-level-3/1146-feel-context-put-function/1146-feel-context-put-function.dmn @@ -0,0 +1,310 @@ + + + FEEL built-in function 'context put(context, key, value)' in category context functions + + + + + context put({}, "a", 1) + + + + + + + get entries(context put({"a": 1}, "b", 2)) + + + + + + + context put({"a": 1}, "a", 2) + + + + + + + context put({"a":1, "b":2, "c":3 }, "b", 3) + + + + + + + context put({}, "", 1) + + + + + + + context put({}, null, 1) + + + + + + + context put(null, "a", 1) + + + + + + + context put({}, "a", null) + + + + + + + context put({}, "a") + + + + + + + context put({}, "a", 1, 1) + + + + + + + context put(context: {}, key: "a", value: 1) + + + + + + + context put(context: {}, ky: "a", value: 1) + + + + + + + context put([], "a", 1) + + + + + + + context put({}, 1, 1) + + + + + + + + + + 1 + + + + + + + + + + + + context put(context01, "a", 2) + + + + + + + + + + + + + context01 + + + + + + context put(context01, "a", 2) + + + + + + + + + + + + {a: 1} + + + + + + context put(original, "a", 2) + + + + + + + + + + + context put({x:1, y: {a: 0} }, ["y", "a"], 2) + + + + + + + context put({x:1, y: {a: 0} }, ["y", "b"], 2) + + + + + + + context put({x:1, y: {a: 0} }, ["y", null], 2) + + + + + + + context put({x:1, y: {a: 0} }, [null, "a"], 2) + + + + + + + context put({x:1, y: {a: 0} }, [null], 2) + + + + + + + context put({x:1, y: {a: 0} }, [], 2) + + + + + + + context put({x:1, y: {a: {b: {c: 1}} }}, ["y", "a", "b", "c"], 2) + + + + + + + context put(context: {x:1, y: {a: 0} }, keys: ["y", "a"], value: 2) + + + + + + + context put(context: {x:1, y: {a: 0} }, key: ["y", "a"], value: 2) + + + + + + + context put({x:1, y: {a: 0}}, ["y", "a", "b", "c"], 2) + + + + + + + + + + + + + 1 + + + + + + + + + + + + + + context put(nestedContext01, ["a", "b"], 2) + + + + + + + + + + + + + nestedContext01 + + + + + + context put(nestedContext01, ["a", "b"], 2) + + + + + + + + + + + + {a: {b: 1}} + + + + + + context put(original, ["a", "b"], 2) + + + + + + +