Public repository: timo / feel

Reader

An interpreter of FEEL, written in Rust, with integrations for PostgreSQL, WASM, Lua, and Python.

1
[
2
  {
3
    "id": "0032-conditionals:001:simpleIf",
4
    "expression": "if bool then num+10 else num-10",
5
    "expected": 110.0,
6
    "expected_type": "number",
7
    "comparison": "f64_epsilon",
8
    "deviation": "feel-core uses f64 arithmetic while the DMN/FEEL spec mandates decimal128, and the TCK rounds non-terminating results to a fixed number of decimal places; numeric results are therefore compared with an epsilon tolerance instead of exact equality to avoid false negatives from either source.",
9
    "context": {
10
      "bool": true,
11
      "num": 100.0
12
    },
13
    "epsilon": 1e-08
14
  },
15
  {
16
    "id": "0032-conditionals:002:simpleIf",
17
    "expression": "if bool then num+10 else num-10",
18
    "expected": 90.0,
19
    "expected_type": "number",
20
    "comparison": "f64_epsilon",
21
    "deviation": "feel-core uses f64 arithmetic while the DMN/FEEL spec mandates decimal128, and the TCK rounds non-terminating results to a fixed number of decimal places; numeric results are therefore compared with an epsilon tolerance instead of exact equality to avoid false negatives from either source.",
22
    "context": {
23
      "bool": false,
24
      "num": 100.0
25
    },
26
    "epsilon": 1e-08
27
  },
28
  {
29
    "id": "0032-conditionals:003:simpleIf",
30
    "expression": "if bool then num+10 else num-10",
31
    "expected": 90.0,
32
    "expected_type": "number",
33
    "comparison": "f64_epsilon",
34
    "deviation": "feel-core uses f64 arithmetic while the DMN/FEEL spec mandates decimal128, and the TCK rounds non-terminating results to a fixed number of decimal places; numeric results are therefore compared with an epsilon tolerance instead of exact equality to avoid false negatives from either source.",
35
    "context": {
36
      "bool": null,
37
      "num": 100.0
38
    },
39
    "epsilon": 1e-08
40
  },
41
  {
42
    "id": "0032-conditionals:004:conditionWithFunctions",
43
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
44
    "expected": "Hello",
45
    "expected_type": "string",
46
    "comparison": "exact",
47
    "deviation": null,
48
    "context": {
49
      "aDate": {
50
        "@type": "date",
51
        "@value": "2017-01-02"
52
      },
53
      "aString": "Hello World"
54
    }
55
  },
56
  {
57
    "id": "0032-conditionals:005:conditionWithFunctions",
58
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
59
    "expected": "World",
60
    "expected_type": "string",
61
    "comparison": "exact",
62
    "deviation": null,
63
    "context": {
64
      "aDate": {
65
        "@type": "date",
66
        "@value": "2017-01-01"
67
      },
68
      "aString": "Hello World"
69
    }
70
  },
71
  {
72
    "id": "0032-conditionals:006:conditionWithFunctions",
73
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
74
    "expected": "World",
75
    "expected_type": "string",
76
    "comparison": "exact",
77
    "deviation": null,
78
    "context": {
79
      "aDate": null,
80
      "aString": "Hello World"
81
    }
82
  }
83
]