Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DMN 1.5 - date increments in loops #660

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,136 @@
</resultNode>
</testCase>

<testCase id="decision_017">
<description>date range increment upwards</description>
<resultNode name="decision_017" type="decision">
<expected>
<list>
<item><value xsi:type="xsd:date">1980-01-01</value></item>
<item><value xsi:type="xsd:date">1980-01-02</value></item>
<item><value xsi:type="xsd:date">1980-01-03</value></item>
</list>
</expected>
</resultNode>
</testCase>

<testCase id="decision_018">
<description>date range increment downwards</description>
<resultNode name="decision_018" type="decision">
<expected>
<list>
<item><value xsi:type="xsd:date">1980-01-03</value></item>
<item><value xsi:type="xsd:date">1980-01-02</value></item>
<item><value xsi:type="xsd:date">1980-01-01</value></item>
</list>
</expected>
</resultNode>
</testCase>

<testCase id="decision_019">
<description>string iteration context gives null</description>
<resultNode name="decision_019" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_019_a">
<description>string range iteration context gives null</description>
<resultNode name="decision_019_a" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_020">
<description>datetime iteration context gives null</description>
<resultNode name="decision_020" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_020_a">
<description>datetime range iteration context gives null</description>
<resultNode name="decision_020_a" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_021">
<description>time iteration context gives null</description>
<resultNode name="decision_021" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_021_a">
<description>time range iteration context gives null</description>
<resultNode name="decision_021_a" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_022">
<description>duration iteration context gives null</description>
<resultNode name="decision_022" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_022_a">
<description>duration range iteration context gives null</description>
<resultNode name="decision_022_a" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

<testCase id="decision_023">
<description>a valid numeric range is permitted as iteration context</description>
<resultNode name="decision_023" type="decision">
<expected>
<list>
<item><value xsi:type="xsd:decimal">1</value></item>
<item><value xsi:type="xsd:decimal">2</value></item>
</list>
</expected>
</resultNode>
</testCase>

<testCase id="decision_024">
<description>a valid date range is permitted as iteration context</description>
<resultNode name="decision_024" type="decision">
<expected>
<list>
<item><value xsi:type="xsd:date">1980-01-01</value></item>
<item><value xsi:type="xsd:date">1980-01-02</value></item>
<item><value xsi:type="xsd:date">1980-01-03</value></item>
</list>
</expected>
</resultNode>
</testCase>

<testCase id="decision_025">
<description>invalid (descending) range gives null</description>
<resultNode name="decision_025" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

</testCases>
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/0084-feel-for-loops" name="0084-feel-for-loops" id="_i9fboPUUEeesLuP4RHs4vA" xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<definitions namespace="http://www.montera.com.au/spec/DMN/0084-feel-for-loops"
name="0084-feel-for-loops"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<description>FEEL for loops</description>

<decision name="decision_001" id="_decision_001">
Expand Down Expand Up @@ -103,4 +107,106 @@
</literalExpression>
</decision>

<decision name="decision_017" id="_decision_017">
<variable name="decision_017"/>
<literalExpression>
<text>for i in @"1980-01-01"..@"1980-01-03" return i</text>
</literalExpression>
</decision>

<decision name="decision_018" id="_decision_018">
<variable name="decision_018"/>
<literalExpression>
<text>for i in @"1980-01-03"..@"1980-01-01" return i</text>
</literalExpression>
</decision>

<decision name="decision_019" id="_decision_019">
<!-- string iteration content type gives null -->
<variable name="decision_019"/>
<literalExpression>
<text>for i in "a".."z" return i</text>
</literalExpression>
</decision>

<decision name="decision_019_a" id="_decision_019_a">
<!-- string range iteration context type gives null -->
<variable name="decision_019_a"/>
<literalExpression>
<text>for i in ["a".."z"] return i</text>
</literalExpression>
</decision>

<decision name="decision_020" id="_decision_020">
<!-- datetime iteration content type gives null -->
<variable name="decision_020"/>
<literalExpression>
<text>for i in @"1980-01-03T00:00:00"..@"1980-01-01T00:00:00" return i</text>
</literalExpression>
</decision>

<decision name="decision_020_a" id="_decision_020_a">
<!-- datetime range iteration context type gives null -->
<variable name="decision_020_a"/>
<literalExpression>
<text>for i in [@"1980-01-03T00:00:00"..@"1980-01-01T00:00:00"] return i</text>
</literalExpression>
</decision>

<decision name="decision_021" id="_decision_021">
<!-- time iteration content type gives null -->
<variable name="decision_021"/>
<literalExpression>
<text>for i in @"00:00:00"..@"00:00:00" return i</text>
</literalExpression>
</decision>

<decision name="decision_021_a" id="_decision_021_a">
<!-- time range iteration context type gives null -->
<variable name="decision_021_a"/>
<literalExpression>
<text>for i in [@"00:00:00"..@"00:00:00"] return i</text>
</literalExpression>
</decision>

<decision name="decision_022" id="_decision_022">
<!-- duration iteration content type gives null -->
<variable name="decision_022"/>
<literalExpression>
<text>for i in @"P1D"..@"P2D" return i</text>
</literalExpression>
</decision>

<decision name="decision_022_a" id="_decision_022_a">
<!-- duration range iteration context type gives null -->
<variable name="decision_022_a"/>
<literalExpression>
<text>for i in [@"P1D"..@"P2D"] return i</text>
</literalExpression>
</decision>

<decision name="decision_023" id="_decision_023">
<!-- a valid numeric range is permitted as iteration context -->
<variable name="decision_023"/>
<literalExpression>
<text>for i in [1..2] return i</text>
</literalExpression>
</decision>

<decision name="decision_024" id="_decision_024">
<!-- a valid date range is permitted as iteration context -->
<variable name="decision_024"/>
<literalExpression>
<text>for i in [@"1980-01-01"..@"1980-01-03"] return i</text>
</literalExpression>
</decision>

<decision name="decision_025" id="_decision_025">
<!-- invalid range gives null (ranges may be descending) -->
<variable name="decision_025"/>
<literalExpression>
<text>for i in [2..1] return i</text>
</literalExpression>
</decision>

</definitions>
Loading