From 61ed65913a56b62e3c5ca5b74b7e0454c9fc576c Mon Sep 17 00:00:00 2001 From: StrayAlien Date: Wed, 15 May 2024 15:08:02 +1000 Subject: [PATCH] DMN 1.5 - 1156-range-function --- .../1156-range-function-test-01.xml | 493 ++++++++++++++++++ .../1156-range-function.dmn | 457 ++++++++++++++++ 2 files changed, 950 insertions(+) create mode 100644 TestCases/compliance-level-3/1156-range-function/1156-range-function-test-01.xml create mode 100644 TestCases/compliance-level-3/1156-range-function/1156-range-function.dmn diff --git a/TestCases/compliance-level-3/1156-range-function/1156-range-function-test-01.xml b/TestCases/compliance-level-3/1156-range-function/1156-range-function-test-01.xml new file mode 100644 index 000000000..c359ec74c --- /dev/null +++ b/TestCases/compliance-level-3/1156-range-function/1156-range-function-test-01.xml @@ -0,0 +1,493 @@ + + + + 1156-range-function.dmn + + + Sanity check something is in range + + + true + + + + + + range(number) instance of range<number> + + + true + + + + + + range(number) instance of range<number> + + + true + + + + + + range(string) instance of range<string> + + + true + + + + + + range(date) instance of range<date> + + + true + + + + + + range(date and time) instance of range<date and time> + + + true + + + + + + range(time) instance of range<time> + + + true + + + + + + range(days and time duration) instance of range<days and time duration> + + + true + + + + + + range(years and months duration) instance of range<years and months duration> + + + true + + + + + + Foo + + + true + + + + + + range() function result equals FEEL range: [..] + + + true + + + + + + range() function result equals FEEL range: (..] + + + true + + + + + + range() function result equals FEEL range: ]..] + + + true + + + + + + range() function result equals FEEL range: [..) + + + true + + + + + + range() function result equals FEEL range: [..[ + + + true + + + + + + closed start endpoint with value and open endpoint with no value is valid and is unary GE equivalent + + + true + + + + + + open start endpoint with value and open endpoint with no value is valid and is unary GT equivalent + + + true + + + + + + open start endpoint with no value and closed endpoint with value is valid and is unary LE equivalent + + + true + + + + + + closed start endpoint with no value and open endpoint with value is valid and is LT equivalent + + + true + + + + + + closed start endpoint with no value is not valid and gives null + + + + + + + + + closed end endpoint with no value is not valid and gives null + + + + + + + + + range(string) function equals a unary FEEL range: string + + + true + + + + + + range(date) function equals a unary FEEL range: date + + + true + + + + + + range(date and time) function equals a unary FEEL range: date and time + + + true + + + + + + range(time) function equals a unary FEEL range: time + + + true + + + + + + range(days and time duration) function equals a unary FEEL range: days and time duration + + + true + + + + + + range(years and months duration) function equals a unary FEEL range: years and months duration + + + true + + + + + + will ignore whitespace when parsing + + + true + + + + + + use of date() function literal is permitted + + + true + + + + + + use of date() function as non literal is not permitted and gives null + + + + + + + + + use of date() function as non literal is not permitted and gives null + + 1970-01-01 + + + + + + + + + + use of date and time() function literal is permitted + + + true + + + + + + use of date and time() function as non literal is not permitted and gives null + + + + + + + + + use of date and time() function as non literal is not permitted and gives null + + 1970-01-01T00:00:00 + + + + + + + + + + use of time() function literal is permitted + + + true + + + + + + use of time() function as non literal is not permitted and gives null + + + + + + + + + use of time() function as non literal is not permitted and gives null + + 00:00:00 + + + + + + + + + + use of duration() function literal is permitted + + + true + + + + + + use of duration() function as non literal is not permitted and gives null + + + + + + + + + use of duration() function as non literal is not permitted and gives null + + P1D + + + + + + + + + + named argument + + + true + + + + + + invalidly named argument gives null + + + + + + + + + too many arguments gives null + + + + + + + + + too few arguments gives null + + + + + + + + + invalid argument type gives null + + + + + + + + + empty string gives null + + + + + + + + + whitespace only gives null + + + + + + + + + non-literal argument providing invalid range string gives null + + + + + + + + + a unary range is not a valid literal range string and gives null + + + + + + + + + mismatching endpoint types gives null + + + + + + + + + + date and date and time end points are not equivalent and give null + + + + + + + + + + date and date and time end points are not equivalent and give null + + + + + + + + + + diff --git a/TestCases/compliance-level-3/1156-range-function/1156-range-function.dmn b/TestCases/compliance-level-3/1156-range-function/1156-range-function.dmn new file mode 100644 index 000000000..2bd72caf1 --- /dev/null +++ b/TestCases/compliance-level-3/1156-range-function/1156-range-function.dmn @@ -0,0 +1,457 @@ + + + FEEL built-in function 'range(string)' in category conversion functions + + + + + + + + + + 2 in range("[1..3]") + + + + + + + + range("[1..3]") instance of range<number> + + + + + + + + range(string("[1..3]")) instance of range<number> + + + + + + + + range("[\"a\"..\"c\"]") instance of range<string> + + + + + + + + range("[@\"1970-01-01\"..@\"1970-01-02\"]") instance of range<date> + + + + + + + + range("[@\"1970-01-01T00:00:00\"..@\"1970-01-02T00:00:00\"]") instance of range<date and time> + + + + + + + + + range("[@\"00:00:00\"..@\"00:00:00\"]") instance of range<time> + + + + + + + + range("[@\"P1D\"..@\"P2D\"]") instance of range<days and time duration> + + + + + + + + range("[@\"P1Y\"..@\"P2Y\"]") instance of range<years and months duration> + + + + + + + + 2 in range(string("[1..3]")) + + + + + + + + range("[18..21]") = [18..21] + + + + + + + + range("(18..21]") = (18..21] + + + + + + + + range("]18..21]") = ]18..21] + + + + + + + + range("[18..21)") = [18..21) + + + + + + + + range("[18..21[") = [18..21[ + + + + + + + + range("[2..)") = >=2 + + + + + + + + range("(2..)") = >2 + + + + + + + + range("(..2]") = <=2 + + + + + + + + range("(..2)") = <2 + + + + + + + + range("[..2]") + + + + + + + + range("[1..]") + + + + + + + + range("[\"a\"..\"c\"]") = ["a".."c"] + + + + + + + + range("[@\"1970-01-01\"..@\"1970-01-02\"]") = [@"1970-01-01"..@"1970-01-02"] + + + + + + + + range("[@\"1970-01-01T00:00:00\"..@\"1970-01-02T00:00:00\"]") = + [@"1970-01-01T00:00:00"..@"1970-01-02T00:00:00"] + + + + + + + + + range("[@\"00:00:00\"..@\"00:00:00\"]") = [@"00:00:00"..@"00:00:00"] + + + + + + + + range("[@\"P1D\"..@\"P2D\"]") = [@"P1D"..@"P2D"] + + + + + + + + range("[@\"P1Y\"..@\"P2Y\"]") = [@"P1Y"..@"P2Y"] + + + + + + + + range(" [ 1 .. 3 ] ") = [1..3] + + + + + + + + range("[date(\"1970-01-01\")..date(\"1970-01-02\")]") = [date("1970-01-01")..date("1970-01-02")] + + + + + + + + + + range("[date(string(\"1970-01-01\"))..date(\"1970-01-02\")]") + + + + + + + + + + + + range("[date(input_001)..date(\"1970-01-02\")]") + + + + + + + + range("[date and time(\"1970-01-01T00:00:00\")..@\"1970-01-02T00:00:00\"]") = + [@"1970-01-01T00:00:00"..@"1970-01-02T00:00:00"] + + + + + + + + + + range("[date and time(string(\"1970-01-01T00:00:00\"))..@\"1970-01-02T00:00:00\"]") + + + + + + + + + + + + range("[date and time(input_001)..@\"1970-01-02T00:00:00\"]") + + + + + + + + range("[time(\"00:00:00\")..@\"00:00:00\"]") = [@"00:00:00"..@"00:00:00"] + + + + + + + + + range("[time(string(\"00:00:00\"))..@\"00:00:00\"]") + + + + + + + + + + + + range("[time(input_001)..@\"00:00:00\"]") + + + + + + + + range("[duration(\"P1D\")..@\"P2D\"]") = [@"P1D"..@"P2D"] + + + + + + + + + range("[duration(string(\"P1D\"))..@\"P2D\"]") + + + + + + + + + + + + range("[duration(input_001)..@\"P2D\"]") + + + + + + + + range(from: "[1..3]") = [1..3] + + + + + + + + range(fron: "[1..3]") + + + + + + + + range("[1..3]", "foo") + + + + + + + + range() + + + + + + + + range([1..3]) + + + + + + + + range("") + + + + + + + + range(" ") + + + + + + + + range(string("")) + + + + + + + + range(">=10") + + + + + + + + range("[1..\"b\"]") + + + + + + + + range("[@\"1970-01-01\"..@\"1970-01-02T00:00:00\"]") + + + + + + + + range("[@\"1970-01-01T00:00:00\"..@\"1970-01-02\"]") + + + + + +