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
    "coerce_to": "number",
10
    "context": {
11
      "bool": true,
12
      "num": 100.0
13
    },
14
    "epsilon": 1e-08
15
  },
16
  {
17
    "id": "0032-conditionals:002:simpleIf",
18
    "expression": "if bool then num+10 else num-10",
19
    "expected": 90.0,
20
    "expected_type": "number",
21
    "comparison": "f64_epsilon",
22
    "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.",
23
    "coerce_to": "number",
24
    "context": {
25
      "bool": false,
26
      "num": 100.0
27
    },
28
    "epsilon": 1e-08
29
  },
30
  {
31
    "id": "0032-conditionals:003:simpleIf",
32
    "expression": "if bool then num+10 else num-10",
33
    "expected": 90.0,
34
    "expected_type": "number",
35
    "comparison": "f64_epsilon",
36
    "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.",
37
    "coerce_to": "number",
38
    "context": {
39
      "bool": null,
40
      "num": 100.0
41
    },
42
    "epsilon": 1e-08
43
  },
44
  {
45
    "id": "0032-conditionals:004:conditionWithFunctions",
46
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
47
    "expected": "Hello",
48
    "expected_type": "string",
49
    "comparison": "exact",
50
    "deviation": null,
51
    "coerce_to": "string",
52
    "context": {
53
      "aDate": {
54
        "@type": "date",
55
        "@value": "2017-01-02"
56
      },
57
      "aString": "Hello World"
58
    }
59
  },
60
  {
61
    "id": "0032-conditionals:005:conditionWithFunctions",
62
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
63
    "expected": "World",
64
    "expected_type": "string",
65
    "comparison": "exact",
66
    "deviation": null,
67
    "coerce_to": "string",
68
    "context": {
69
      "aDate": {
70
        "@type": "date",
71
        "@value": "2017-01-01"
72
      },
73
      "aString": "Hello World"
74
    }
75
  },
76
  {
77
    "id": "0032-conditionals:006:conditionWithFunctions",
78
    "expression": "if aDate > date(\"2017-01-01\") then substring before(aString, \" \") else substring after(aString, \" \")",
79
    "expected": "World",
80
    "expected_type": "string",
81
    "comparison": "exact",
82
    "deviation": null,
83
    "coerce_to": "string",
84
    "context": {
85
      "aDate": null,
86
      "aString": "Hello World"
87
    }
88
  }
89
]