[ { "name": "Fields", "context": { "value": { "Number": 1, "Bool": true, "String": "Hey" }, "previousValue": { "Number": 2, "Bool": false, "String": "Hi" } }, "checks": [ { "expr": "Number", "expected": 1 }, { "expr": "Bool", "expected": true }, { "expr": "String", "expected": "Hey" }, { "expr": "[Number]", "expected": 1 }, { "expr": "[Bool]", "expected": true }, { "expr": "[String]", "expected": "Hey" }, { "expr": "LAST Number", "expected": 2 }, { "expr": "LAST Bool", "expected": false }, { "expr": "LAST String", "expected": "Hi" }, { "expr": "[LAST Number]", "expected": 2 }, { "expr": "[LAST Bool]", "expected": false }, { "expr": "[LAST String]", "expected": "Hi" }, { "expr": "Number = Number", "expected": true }, { "expr": "Bool = Bool", "expected": true }, { "expr": "String = String", "expected": true } ] }, { "name": "Numeric ops", "context": { "value": { "Two": 2, "Three": 3, "Six": 6, "Tau": 6.28318, "Euler": 2.71828 } }, "checks": [ { "expr": "Two + Three", "expected": 5 }, { "expr": "Three - Two", "expected": 1 }, { "expr": "Two * Three", "expected": 6 }, { "expr": "Six / Two", "expected": 3 }, { "expr": "Tau + Two", "expected": 8.28318 }, { "expr": "Tau / Two", "expected": 3.14159 }, { "expr": "Tau * Euler > 17.079 .AND. Tau * Euler < 17.081", "expected": true }, { "expr": "Six .MOD. Two", "expected": 0 }, { "expr": "Three .MOD. Two", "expected": 1 }, { "expr": "Three / 0", "error": true }, { "expr": "Two + .EMPTY.", "error": true }, { "expr": "Two - .EMPTY.", "error": true }, { "expr": "Two * .EMPTY.", "error": true }, { "expr": "Two / .EMPTY.", "error": true } ] }, { "name": "String concat", "context": { "value": { "Greeting": "Hello", "Subject": "World" } }, "checks": [ { "expr": "Greeting || Subject", "expected": "HelloWorld" }, { "expr": "Greeting || ', ' || Subject", "expected": "Hello, World" }, { "expr": "Greeting || \", \" || Subject", "expected": "Hello, World" } ] }, { "name": "Time math", "context": { "value": { "Date": "2023-04-21", "Timestamp": "2023-04-21T01:02:03.000Z", "DateTwo": "2023-04-19", "TimestampTwo": "2023-04-21T01:01:03.000Z" } }, "checks": [ { "expr": "Date + 1", "expected": "2023-04-22" }, { "expr": "1 + Date", "expected": "2023-04-22" }, { "expr": "Date - 1", "expected": "2023-04-20" }, { "expr": "Timestamp + 1", "expected": "2023-04-22T01:02:03.000Z" }, { "expr": "1 + Timestamp", "expected": "2023-04-22T01:02:03.000Z" }, { "expr": "Timestamp - 1", "expected": "2023-04-20T01:02:03.000Z" }, { "expr": "Timestamp + 1.0", "expected": "2023-04-22T01:02:03.000Z" }, { "expr": "1.0 + Timestamp", "expected": "2023-04-22T01:02:03.000Z" }, { "expr": "Timestamp - 1.0", "expected": "2023-04-20T01:02:03.000Z" }, { "expr": "Timestamp + (1.0 / (24 * 60))", "expected": "2023-04-21T01:03:03.000Z" }, { "expr": "Timestamp - (1.0 / (24 * 60))", "expected": "2023-04-21T01:01:03.000Z" }, { "expr": "Date - DateTwo", "expected": 2 }, { "expr": "(Timestamp - TimestampTwo) > (0.9 / (24 * 60)) .AND. (Timestamp - TimestampTwo) < (1.1 / (24 * 60)) ", "expected": true } ] } ]