[
  {
    "id": "0030-user-defined-functions:hand:simple-positional",
    "expression": "{f: function(a, b) a + b, r: f(\"feel\", \"#\") + f(\"feel\", \"#\")}.r",
    "expected": "feel#feel#",
    "expected_type": "string",
    "comparison": "exact",
    "deviation": null,
    "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#'."
  },
  {
    "id": "0030-user-defined-functions:hand:named-swapped",
    "expression": "{f: function(a, b) a + b, r: f(b: \"feel\", a: \"#\") + f(b: \"feel\", a: \"#\")}.r",
    "expected": "#feel#feel",
    "expected_type": "string",
    "comparison": "exact",
    "deviation": null,
    "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)."
  },
  {
    "id": "0031-user-defined-functions:hand:positional-arithmetic",
    "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",
    "expected": [7.0, -1.0, 12.0],
    "expected_type": "list",
    "comparison": "exact",
    "deviation": null,
    "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."
  },
  {
    "id": "0031-user-defined-functions:hand:named-parameters",
    "expression": "{subFn: function(a, b) a - b, r: subFn(a: 3, b: 4)}.r",
    "expected": -1.0,
    "expected_type": "number",
    "comparison": "exact",
    "deviation": null,
    "source": "Hand-written; mirrors DMN-TCK 0031 'fn invocation named parameters' subFn(a: inputA, b: inputB) with inputA=3, inputB=4 -> 3-4 = -1."
  },
  {
    "id": "0031-user-defined-functions:hand:conditional-body-guard",
    "expression": "{divFn: function(a, b) if b = 0 then null else a / b, r: divFn(8, 0)}.r",
    "expected": null,
    "expected_type": "null",
    "comparison": "exact",
    "deviation": null,
    "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."
  },
  {
    "id": "0030-user-defined-functions:hand:lexical-closure",
    "expression": "{base: 100, addBase: function(x) x + base, r: addBase(5)}.r",
    "expected": 105.0,
    "expected_type": "number",
    "comparison": "exact",
    "deviation": null,
    "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."
  },
  {
    "id": "0030-user-defined-functions:hand:mixed-arguments",
    "expression": "{subFn: function(a, b) a - b, r: subFn(7, b: 2)}.r",
    "expected": 5.0,
    "expected_type": "number",
    "comparison": "exact",
    "deviation": null,
    "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)."
  }
]
