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

Add tests to cover context types #624

Merged
merged 1 commit into from
Nov 16, 2023
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 @@ -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>
Loading