Skip to content

Commit

Permalink
DMN 1.5 - 'e' number equivalence (#659)
Browse files Browse the repository at this point in the history
* 'e' number equivalence

* removed 'flickering' time_009 test - based on zoned times which are being removed.  As per PR comments.

* changed assertions on equality checks between unary comparison range and normal ranges to be in line with 1.5.  Added a few additional tests for unary comparison range equality.
  • Loading branch information
StrayAlien authored Sep 19, 2024
1 parent 5d67b89 commit 3c6c8db
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,33 @@
</resultNode>
</testCase>

<testCase id="number_008">
<description>number equals literal 'e' exponent number with default sign</description>
<resultNode name="number_008" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<testCase id="number_009">
<description>number equals literal 'e' exponent number with '+' sign</description>
<resultNode name="number_009" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<testCase id="number_010">
<description>number equals literal 'e' exponent number with '-' sign</description>
<resultNode name="number_010" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<testCase id="string_001">
<description>string equals</description>
<resultNode name="string_001" type="decision">
Expand Down Expand Up @@ -551,15 +578,6 @@
<!-- </resultNode>-->
<!-- </testCase>-->

<testCase id="time_009">
<description>same times = one with offset, the other with zone are equal if offsets are equal</description>
<resultNode name="time_009" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<!-- commented out pending RTF equality comparisons with zones clarification -->
<!-- https://github.com/dmn-tck/tck/pull/389#issuecomment-881322326 -->
<!-- <testCase id="time_009_a">-->
Expand Down Expand Up @@ -1087,51 +1105,77 @@
</testCase>

<testCase id="range_006">
<description>equal ranges though syntactically different: LT </description>
<inputNode name="null_input">
<value xsi:nil="true"/>
</inputNode>
<description>equal ranges though syntactically different are not equal: LT </description>
<resultNode name="range_006" type="decision">
<expected>
<value xsi:type="xsd:boolean">false</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_006_a">
<description>unary syntax comparison range LT</description>
<resultNode name="range_006_a" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_007">
<description>equal ranges though syntactically different: LE </description>
<inputNode name="null_input">
<value xsi:nil="true"/>
</inputNode>
<description>equal ranges though syntactically different are not equal: LE </description>
<resultNode name="range_007" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
<value xsi:type="xsd:boolean">false</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_008">
<description>equal ranges though syntactically different: GT </description>
<inputNode name="null_input">
<value xsi:nil="true"/>
</inputNode>
<description>equal ranges though syntactically different are not equal: GT </description>
<resultNode name="range_008" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
<value xsi:type="xsd:boolean">false</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_009">
<description>equal ranges though syntactically different: GE </description>
<inputNode name="null_input">
<value xsi:nil="true"/>
</inputNode>
<description>equal ranges though syntactically different are not equal: GE </description>
<resultNode name="range_009" type="decision">
<expected>
<value xsi:type="xsd:boolean">false</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_010">
<description>equal ranges though syntactically different are not equal: EQ </description>
<resultNode name="range_010" type="decision">
<expected>
<value xsi:type="xsd:boolean">false</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_011">
<description>unary syntax comparison range EQ</description>
<resultNode name="range_011" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>

<testCase id="range_012">
<description>unary syntax comparison range NE</description>
<resultNode name="range_012" type="decision">
<expected>
<value xsi:type="xsd:boolean">true</value>
</expected>
</resultNode>
</testCase>



</testCases>
146 changes: 91 additions & 55 deletions TestCases/compliance-level-3/0068-feel-equality/0068-feel-equality.dmn
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions namespace="http://www.montera.com.au/spec/DMN/0068-feel-equality" name="0068-feel-equality"
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">
<definitions namespace="http://www.montera.com.au/spec/DMN/0068-feel-equality"
name="0068-feel-equality"
id="_i9fboPUUEeesLuP4RHs4vA"
xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/"
>
<description>FEEL equality</description>

<inputData name="null_input" id="_null_input">
<variable name="null_input" typeRef="Any"/> <!-- some test cases always supply value `null` for this InputData -->
</inputData>

<decision name="null_001" id="_null_001">
<description>Tests FEEL expression: 'null = null' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression 'null = null'?</question>
Expand Down Expand Up @@ -190,6 +186,36 @@
</literalExpression>
</decision>

<decision name="number_008" id="_number_008">
<description>Tests FEEL expression: '12300 = 1.23e4' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression '12300 = 1.23e4'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="number_008"/>
<literalExpression>
<text>12300 = 1.23e4</text>
</literalExpression>
</decision>

<decision name="number_009" id="_number_009">
<description>Tests FEEL expression: '12300 = 1.23e+4' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression '12300 = 1.23e+4'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="number_009"/>
<literalExpression>
<text>12300 = 1.23e+4</text>
</literalExpression>
</decision>

<decision name="number_010" id="_number_010">
<description>Tests FEEL expression: '0.000123 = 1.23e-4' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression '0.000123 = 1.23e-4'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="number_010"/>
<literalExpression>
<text>0.000123 = 1.23e-4</text>
</literalExpression>
</decision>

<decision name="string_001" id="_string_001">
<description>Tests FEEL expression: '"foo" = "foo"' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression '"foo" = "foo"'?</question>
Expand Down Expand Up @@ -615,16 +641,6 @@
<!-- </literalExpression>-->
<!-- </decision>-->

<decision name="time_009" id="_time_009">
<description>Tests FEEL expression: 'time("10:30:00+01:00") = time("10:30:00@Europe/Paris")' and expects result: 'true (boolean)'</description>
<question>Result of FEEL expression 'time("10:30:00+01:00") = time("10:30:00@Europe/Paris")'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="time_009"/>
<literalExpression>
<text>time("10:30:00+01:00") = time("10:30:00@Europe/Paris")</text>
</literalExpression>
</decision>

<!-- commented out pending RTF equality comparisons with zones clarification -->
<!-- https://github.com/dmn-tck/tck/pull/389#issuecomment-881322326 -->
<!-- <decision name="time_009_a" id="_time_009_a">-->
Expand Down Expand Up @@ -1243,62 +1259,82 @@
</decision>

<decision name="range_006" id="_range_006">
<description>Tests FEEL expression: "(&lt; 10) = (null_input..10)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(&lt; 10) = (null_input..10)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<description>Tests FEEL expression: "(&lt; 10) = (null..10)" and expects result: 'false (boolean)'</description>
<question>Tests FEEL expression: '(&lt; 10) = (null..10)'?</question>
<allowedAnswers>false (boolean)</allowedAnswers>
<variable name="range_006"/>
<!-- to provide null as a range endpoint. As at DMN 1.3, a literal null is
not grammatically permitted -->
<informationRequirement>
<requiredInput href="#_null_input"/>
</informationRequirement>
<literalExpression>
<text>(&lt; 10) = (null_input..10)</text>
<text>(&lt; 10) = (null..10)</text>
</literalExpression>
</decision>

<decision name="range_007" id="_range_007">
<description>Tests FEEL expression: "(&lt;= 10) = (null_input..10]" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(&lt;= 10) = (null_input..10]'?</question>
<decision name="range_006_a" id="_range_006_a">
<description>Tests FEEL expression: "(&lt; 10) = (&lt; 10)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(&lt; 10) = (&lt; 10)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="range_006_a"/>
<literalExpression>
<text>(&lt; 10) = (&lt; 10)</text>
</literalExpression>
</decision>

<decision name="range_007" id="_range_007">
<description>Tests FEEL expression: "(&lt;= 10) = (null..10]" and expects result: 'false (boolean)'</description>
<question>Tests FEEL expression: '(&lt;= 10) = (null..10]'?</question>
<allowedAnswers>false (boolean)</allowedAnswers>
<variable name="range_007"/>
<!-- to provide null as a range endpoint. As at DMN 1.3, a literal null is
not grammatically permitted -->
<informationRequirement>
<requiredInput href="#_null_input"/>
</informationRequirement>
<literalExpression>
<text>(&lt;= 10) = (null_input..10]</text>
<text>(&lt;= 10) = (null..10]</text>
</literalExpression>
</decision>

<decision name="range_008" id="_range_008">
<description>Tests FEEL expression: "(&gt; 10) = (10..null_input)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(&gt; 10) = (10..null_input)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<description>Tests FEEL expression: "(&gt; 10) = (10..null)" and expects result: 'false (boolean)'</description>
<question>Tests FEEL expression: '(&gt; 10) = (10..null)'?</question>
<allowedAnswers>false (boolean)</allowedAnswers>
<variable name="range_008"/>
<!-- to provide null as a range endpoint. As at DMN 1.3, a literal null is
not grammatically permitted -->
<informationRequirement>
<requiredInput href="#_null_input"/>
</informationRequirement>
<literalExpression>
<text>(&gt; 10) = (10..null_input)</text>
<text>(&gt; 10) = (10..null)</text>
</literalExpression>
</decision>

<decision name="range_009" id="_range_009">
<description>Tests FEEL expression: "(&gt;= 10) = [10..null_input)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(&gt;= 10) = [10..null_input)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<description>Tests FEEL expression: "(&gt;= 10) = [10..null)" and expects result: 'false (boolean)'</description>
<question>Tests FEEL expression: '(&gt;= 10) = [10..null)'?</question>
<allowedAnswers>false (boolean)</allowedAnswers>
<variable name="range_009"/>
<!-- to provide null as a range endpoint. As at DMN 1.3, a literal null is
not grammatically permitted -->
<informationRequirement>
<requiredInput href="#_null_input"/>
</informationRequirement>
<literalExpression>
<text>(&gt;= 10) = [10..null_input)</text>
<text>(&gt;= 10) = [10..null)</text>
</literalExpression>
</decision>

<decision name="range_010" id="_range_010">
<description>Tests FEEL expression: "(=10) = [10..10]" and expects result: 'false (boolean)'</description>
<question>Tests FEEL expression: '(=10) = [10..10]'?</question>
<allowedAnswers>false (boolean)</allowedAnswers>
<variable name="range_010"/>
<literalExpression>
<text>(=10) = [10..10]</text>
</literalExpression>
</decision>

<decision name="range_011" id="_range_011">
<description>Tests FEEL expression: "(=10) = (=10)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(=10) = (=10)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="range_011"/>
<literalExpression>
<text>(=10) = (=10)</text>
</literalExpression>
</decision>

<decision name="range_012" id="_range_012">
<description>Tests FEEL expression: "(!=10) = (!=10)" and expects result: 'true (boolean)'</description>
<question>Tests FEEL expression: '(!=10) = (!=10)'?</question>
<allowedAnswers>true (boolean)</allowedAnswers>
<variable name="range_012"/>
<literalExpression>
<text>(!=10) = (!=10)</text>
</literalExpression>
</decision>

Expand Down

0 comments on commit 3c6c8db

Please sign in to comment.