| 1 | [ |
| 2 | { |
| 3 | "id": "0030-user-defined-functions:hand:simple-positional", |
| 4 | "expression": "{f: function(a, b) a + b, r: f(\"feel\", \"#\") + f(\"feel\", \"#\")}.r", |
| 5 | "expected": "feel#feel#", |
| 6 | "expected_type": "string", |
| 7 | "comparison": "exact", |
| 8 | "deviation": null, |
| 9 | "source": "Hand-written (DMN-TCK 0030-user-defined-functions cannot be auto-ingested: the decision logic is a boxed <context>/<functionDefinition>, not a literal expression). Mirrors testCase 001 'simple function invocation' with stringInputA='feel', stringInputB='#': boxedFn(a,b)=a+b and literalFn=function(a,b) a+b, result boxedFn(A,B)+literalFn(A,B) = 'feel#'+'feel#' = 'feel#feel#'." |
| 10 | }, |
| 11 | { |
| 12 | "id": "0030-user-defined-functions:hand:named-swapped", |
| 13 | "expression": "{f: function(a, b) a + b, r: f(b: \"feel\", a: \"#\") + f(b: \"feel\", a: \"#\")}.r", |
| 14 | "expected": "#feel#feel", |
| 15 | "expected_type": "string", |
| 16 | "comparison": "exact", |
| 17 | "deviation": null, |
| 18 | "source": "Hand-written; mirrors DMN-TCK 0030 testCase 001 'named function invocation' f(b: stringInputA, a: stringInputB): with the names swapped the result is '#feel'+'#feel' = '#feel#feel' (FEEL spec rule 40 named parameters)." |
| 19 | }, |
| 20 | { |
| 21 | "id": "0031-user-defined-functions:hand:positional-arithmetic", |
| 22 | "expression": "{sumFn: function(a, b) a + b, subFn: function(a, b) a - b, multiplyFn: function(a, b) a * b, r: [sumFn(3, 4), subFn(3, 4), multiplyFn(3, 4)]}.r", |
| 23 | "expected": [7.0, -1.0, 12.0], |
| 24 | "expected_type": "list", |
| 25 | "comparison": "exact", |
| 26 | "deviation": null, |
| 27 | "source": "Hand-written; mirrors DMN-TCK 0031-user-defined-functions 'fn invocation positional parameters' (sumFn/subFn/multiplyFn from a function library) with inputA=3, inputB=4. The library/namespace import form (fn library.sumFn) is outside the slice, so the functions are inlined here." |
| 28 | }, |
| 29 | { |
| 30 | "id": "0031-user-defined-functions:hand:named-parameters", |
| 31 | "expression": "{subFn: function(a, b) a - b, r: subFn(a: 3, b: 4)}.r", |
| 32 | "expected": -1.0, |
| 33 | "expected_type": "number", |
| 34 | "comparison": "exact", |
| 35 | "deviation": null, |
| 36 | "source": "Hand-written; mirrors DMN-TCK 0031 'fn invocation named parameters' subFn(a: inputA, b: inputB) with inputA=3, inputB=4 -> 3-4 = -1." |
| 37 | }, |
| 38 | { |
| 39 | "id": "0031-user-defined-functions:hand:conditional-body-guard", |
| 40 | "expression": "{divFn: function(a, b) if b = 0 then null else a / b, r: divFn(8, 0)}.r", |
| 41 | "expected": null, |
| 42 | "expected_type": "null", |
| 43 | "comparison": "exact", |
| 44 | "deviation": null, |
| 45 | "source": "Hand-written; mirrors DMN-TCK 0031 divideFn = function(a,b) if b = 0 then null else a/b, here invoked with a divisor of 0 -> null." |
| 46 | }, |
| 47 | { |
| 48 | "id": "0030-user-defined-functions:hand:lexical-closure", |
| 49 | "expression": "{base: 100, addBase: function(x) x + base, r: addBase(5)}.r", |
| 50 | "expected": 105.0, |
| 51 | "expected_type": "number", |
| 52 | "comparison": "exact", |
| 53 | "deviation": null, |
| 54 | "source": "Hand-written; exercises FEEL lexical closures (spec §10.3.2.9): the function body references 'base' from the scope it was defined in. Not a specific TCK case." |
| 55 | }, |
| 56 | { |
| 57 | "id": "0030-user-defined-functions:hand:mixed-arguments", |
| 58 | "expression": "{subFn: function(a, b) a - b, r: subFn(7, b: 2)}.r", |
| 59 | "expected": 5.0, |
| 60 | "expected_type": "number", |
| 61 | "comparison": "exact", |
| 62 | "deviation": null, |
| 63 | "source": "Hand-written; exercises MIXED positional+named arguments (f(7, b: 2)), a deliberate tolerant superset over FEEL spec rule 39 (ADR-23). No TCK case (the TCK never mixes)." |
| 64 | } |
| 65 | ] |