Skip to content

Commit

Permalink
Add tests to cover context types (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
opatrascoiu authored Nov 16, 2023
1 parent 835c384 commit 1bbcffd
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,41 @@ null // BKM variable's typeRef is number.
</resultNode>
</testCase> -->

<testCase id="decision_context_01">
<description>Value of context() equivalentTo the decision typeRef</description>
<resultNode name="decision_context_01" type="decision">
<expected>
<component name="a">
<value xsi:type="xsd:decimal">1</value>
</component>
<component name="b">
<value xsi:type="xsd:decimal">2</value>
</component>
</expected>
</resultNode>
</testCase>

<testCase id="decision_context_02">
<description>Value of context() conformsTo the decision typeRef</description>
<resultNode name="decision_context_02" type="decision">
<expected>
<component name="a">
<value xsi:type="xsd:decimal">1</value>
</component>
<component name="b">
<value xsi:type="xsd:decimal">2</value>
</component>
</expected>
</resultNode>
</testCase>

<testCase id="decision_context_03">
<description>Value of context() does not conformsTo the decision typeRef</description>
<resultNode name="decision_context_03" type="decision">
<expected>
<value xsi:nil="true"/>
</expected>
</resultNode>
</testCase>

</testCases>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,33 @@
</itemComponent>
</itemDefinition>

<itemDefinition name="exactContextType" label="ExactContextType" id="_exactContextType">
<itemComponent name="a" id="_ae">
<typeRef>number</typeRef>
</itemComponent>
<itemComponent name="b" id="_be">
<typeRef>number</typeRef>
</itemComponent>
</itemDefinition>

<itemDefinition name="superContextType" label="SuperContextType" id="_superContextType">
<itemComponent name="a" id="_as">
<typeRef>number</typeRef>
</itemComponent>
</itemDefinition>

<itemDefinition name="otherContextType" label="OtherContextType" id="_otherContextType">
<itemComponent name="a" id="_ao">
<typeRef>number</typeRef>
</itemComponent>
<itemComponent name="b" id="_b">
<typeRef>number</typeRef>
</itemComponent>
<itemComponent name="c" id="_c">
<typeRef>number</typeRef>
</itemComponent>
</itemDefinition>

<decision name="decision_001" id="_decision_001">
<variable typeRef="string" name="decision_001"/>
<literalExpression>
Expand Down Expand Up @@ -519,5 +546,26 @@
</literalExpression>
</decision>

<decision name="decision_context_01" id="_decision_context_01">
<variable name="decision_context_01" typeRef="exactContextType"/>
<literalExpression>
<text>context(entries: [{key:"a", value:1}, {key:"b", value:2}])</text>
</literalExpression>
</decision>

<decision name="decision_context_02" id="_decision_context_02">
<variable name="decision_context_02" typeRef="superContextType"/>
<literalExpression>
<text>context(entries: [{key:"a", value:1}, {key:"b", value:2}])</text>
</literalExpression>
</decision>

<decision name="decision_context_03" id="_decision_context_03">
<variable name="decision_context_03" typeRef="otherContextType"/>
<literalExpression>
<text>context(entries: [{key:"a", value:1}, {key:"b", value:2}])</text>
</literalExpression>
</decision>


</definitions>

0 comments on commit 1bbcffd

Please sign in to comment.