Skip to content

Commit

Permalink
assertions for input and output values unary tests in decision tables
Browse files Browse the repository at this point in the history
  • Loading branch information
StrayAlien committed Jul 26, 2024
1 parent 66d9593 commit 958880d
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</testCase>

<testCase id="006_b">
<description>input values: input expression is valid against input values - '?' inside literal string</description>
<description>input values: "?" symbol alone is not satisfied</description>
<resultNode name="decision006_b" type="decision">
<expected>
<value xsi:type="xsd:string">success</value>
Expand All @@ -80,7 +80,7 @@
</testCase>

<testCase id="006_c">
<description>input values: "?" symbol alone always is a match</description>
<description>input values: "?" symbol alone will be satisfied a true value</description>
<resultNode name="decision006_c" type="decision">
<expected>
<value xsi:type="xsd:string">success</value>
Expand All @@ -101,8 +101,8 @@
<!-- "One of the expressions in the UnaryTests evaluates to true when the implicit value
is applied to it." -->
<!-- this test is to exercise the vagueness of 'applied to'. One of the expressions is simply
"true". Which, as an expression always evaluates to true. So ... should match. But, in practice,
the value of "false" applied against unary tests "("123", true)" should not match any of them. My
"true". Which, as an expression always evaluates to true. So ... should satisfy. But, in practice,
the value of "false" applied against unary tests "("123", true)" should not satisfy any of them. My
interpretation is that "applied to" is meant for unary comparisons. -->
<description>input values: boolean expression is weird</description>
<resultNode name="decision008" type="decision">
Expand All @@ -112,8 +112,19 @@
</resultNode>
</testCase>

<testCase id="008_a">
<!-- further to 008, an input expression of boolean "false" will not be satisfied against a rule
unary test of boolean constant "true"-->
<description>input values: boolean expression is weird</description>
<resultNode name="decision008_a" type="decision">
<expected>
<value xsi:type="xsd:string">success</value>
</expected>
</resultNode>
</testCase>

<testCase id="009">
<description>output values: result matches output values</description>
<description>output values: result satisfies output values</description>
<resultNode name="decision009" type="decision">
<expected>
<value xsi:type="xsd:string">success</value>
Expand All @@ -122,7 +133,7 @@
</testCase>

<testCase id="010">
<description>output values: result does not matches output values</description>
<description>output values: result does not satisfy output values</description>
<resultNode name="decision010" type="decision" errorResult="true">
<expected>
<value xsi:nil="true"/>
Expand All @@ -149,7 +160,7 @@
</testCase>

<testCase id="013">
<description>output values: multiple columns - all match</description>
<description>output values: multiple columns - all satisfied</description>
<resultNode name="decision013" type="decision">
<expected>
<component name="col1">
Expand All @@ -163,7 +174,7 @@
</testCase>

<testCase id="014">
<description>output values: multiple columns - column mismatch</description>
<description>output values: multiple columns - column not satisfied</description>
<resultNode name="decision014" type="decision">
<expected>
<component name="col1">
Expand All @@ -177,7 +188,7 @@
</testCase>

<testCase id="015">
<description>output values: ? used in tests - match</description>
<description>output values: ? used in tests - satisfied</description>
<resultNode name="decision015" type="decision">
<expected>
<value xsi:type="xsd:string">foo</value>
Expand All @@ -186,7 +197,7 @@
</testCase>

<testCase id="016">
<description>output values: ? used in tests - mismatch</description>
<description>output values: ? used in tests - not satisfied</description>
<resultNode name="decision016" type="decision">
<expected>
<value xsi:nil="true"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<decision name="decision001" id="_decision001">
<!-- input expression is valid against input values - positive unary tests -->
<!-- input expression 123 will match unary tests and thus the rule for 123 will match -->
<!-- input expression 123 will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision001"/>
<decisionTable>
<input>
Expand All @@ -37,7 +37,7 @@

<decision name="decision002" id="_decision002">
<!-- input expression is valid against input values - range -->
<!-- input expression 123 will match unary tests and thus the rule for 123 will match -->
<!-- input expression 123 will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision002"/>
<decisionTable>
<input>
Expand All @@ -62,7 +62,7 @@

<decision name="decision003" id="_decision003">
<!-- input expression is valid against input values - '-' char -->
<!-- input expression 123 will match unary tests and thus the rule for 123 will match -->
<!-- input expression 123 will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision003"/>
<decisionTable>
<input>
Expand All @@ -87,7 +87,7 @@

<decision name="decision004" id="_decision004">
<!-- input expression is valid against input values - negation using not() -->
<!-- input expression 123 will match unary tests and thus the rule for 123 will match -->
<!-- input expression 123 will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision004"/>
<decisionTable>
<input>
Expand All @@ -113,7 +113,7 @@

<decision name="decision005" id="_decision005">
<!-- input expression is not valid against input values and will become null -->
<!-- input expression 123 will not match unary tests and thus the rule for null will match -->
<!-- input expression 123 will not satisfy unary tests and thus the rule for null will be satisfied -->
<variable name="decision005"/>
<decisionTable>
<input>
Expand All @@ -138,7 +138,7 @@

<decision name="decision006" id="_decision006">
<!-- input expression is valid against input values - '?' symbol with built-in function-->
<!-- input expression "foo" will match unary tests and thus the rule for 123 will match -->
<!-- input expression "foo" will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision006"/>
<decisionTable>
<input>
Expand All @@ -165,8 +165,8 @@
<!-- input expression is not valid against input values - '?' symbol inside literal string -->
<!-- in this case, the `string length("?") = 1` does evaluate to true, but, true !== "foo" and the
vagueness of "applied to" comes in - the expression "string length("?") = 1" does not use the
special char "?", not is it a unary comparison .. so it is a mismatch -->
<!-- input expression "foo" will not match unary tests and thus the rule for null will match -->
special char "?", not is it a unary comparison .. so it is not satisfied -->
<!-- input expression "foo" will not satisfy unary tests and thus the rule for null will be satisfied -->
<variable name="decision006_a"/>
<decisionTable>
<input>
Expand All @@ -190,15 +190,14 @@
</decision>

<decision name="decision006_b" id="_decision006_b">
<!-- input expression is not valid against input values - '?' symbol inside literal string -->
<!-- in this case, the `string length("?") = 1` does evaluate to true, but, true !== "foo" so
it is a mismatch -->
<!-- input expression 123 will not match unary tests and thus the rule for null will match -->
<!-- '?' symbol -->
<!-- input expression "foo" executed against "?" does not return true and thus the rule for null will be satisfied -->
<!-- spec states that an expression with "?" must return a boolean "true" for it to be satisfied -->
<variable name="decision006_b"/>
<decisionTable>
<input>
<inputExpression>
<text>123</text>
<text>"foo"</text>
</inputExpression>
<inputValues>
<text>?</text>
Expand All @@ -207,7 +206,7 @@
<output/>
<rule>
<inputEntry>
<text>123</text>
<text>null</text>
</inputEntry>
<outputEntry>
<text>"success"</text>
Expand All @@ -218,12 +217,13 @@

<decision name="decision006_c" id="_decision006_c">
<!-- '?' symbol -->
<!-- input expression "foo" will match "?" and thus the rule for "123"" will match -->
<!-- input expression `true` executed against "?" returns true and thus the rule for true will be satisfied -->
<!-- spec states that an expression with "?" must return a boolean "true" for it to be satisfied -->
<variable name="decision006_c"/>
<decisionTable>
<input>
<inputExpression>
<text>"foo"</text>
<text>true</text>
</inputExpression>
<inputValues>
<text>?</text>
Expand All @@ -232,7 +232,7 @@
<output/>
<rule>
<inputEntry>
<text>"foo"</text>
<text>true</text>
</inputEntry>
<outputEntry>
<text>"success"</text>
Expand All @@ -244,7 +244,7 @@
<decision name="decision007" id="_decision007">
<!-- input expression is valid against input values - input value has no text-->
<!-- spec says text is optional -->
<!-- input expression 123 will match unary tests and thus the rule for 123 will match -->
<!-- input expression 123 will satisfy unary tests and thus the rule for 123 will be satisfied -->
<variable name="decision007"/>
<decisionTable>
<input>
Expand All @@ -269,8 +269,8 @@

<decision name="decision008" id="_decision008">
<!-- Odd handling for boolean. 'true' is an expression. Unary tests permit expressions but
in this case the input expression false will not match unary tests and thus the
rule for null will match -->
in this case the input expression false will not satisfy unary tests and thus the
rule for null will be satisfied -->
<variable name="decision008"/>
<decisionTable>
<input>
Expand All @@ -293,8 +293,39 @@
</decisionTable>
</decision>

<decision name="decision008_a" id="_decision008_a">
<!-- Odd handling for boolean. 'true' is an expression. Unary tests permit expressions but
in this case the input expression false will not satisfy unary tests and thus the
rule for null will be satisfied -->
<variable name="decision008_a"/>
<decisionTable>
<input>
<inputExpression>
<text>false</text>
</inputExpression>
</input>
<output/>
<rule>
<inputEntry>
<text>true</text>
</inputEntry>
<outputEntry>
<text>"fail"</text>
</outputEntry>
</rule>
<rule>
<inputEntry>
<text>false</text>
</inputEntry>
<outputEntry>
<text>"success"</text>
</outputEntry>
</rule>
</decisionTable>
</decision>

<decision name="decision009" id="_decision009">
<!-- table result matches output values -->
<!-- table result satisfies output values -->
<variable name="decision009"/>
<decisionTable>
<input>
Expand All @@ -319,7 +350,7 @@
</decision>

<decision name="decision010" id="_decision010">
<!-- table result "foo" does not match output values "success" or "failure". Result
<!-- table result "foo" does not satisfy output values "success" or "failure". Result
is null coerced -->
<variable name="decision010"/>
<decisionTable>
Expand Down Expand Up @@ -395,7 +426,7 @@
</decision>

<decision name="decision013" id="_decision013">
<!-- multiple output columns all match -->
<!-- multiple output columns all satisfied -->
<variable name="decision013"/>
<decisionTable>
<input>
Expand Down Expand Up @@ -428,7 +459,7 @@
</decision>

<decision name="decision014" id="_decision014">
<!-- multiple output columns - one column mismatch -->
<!-- multiple output columns - one column not satisfied -->
<variable name="decision014"/>
<decisionTable>
<input>
Expand Down Expand Up @@ -461,7 +492,7 @@
</decision>

<decision name="decision015" id="_decision015">
<!-- ? used in output values - match -->
<!-- ? used in output values - satisfied -->
<variable name="decision015"/>
<decisionTable>
<input>
Expand All @@ -486,7 +517,7 @@
</decision>

<decision name="decision016" id="_decision016">
<!-- ? used in output values - mismatch -->
<!-- ? used in output values - not satisfied -->
<variable name="decision016"/>
<decisionTable>
<input>
Expand Down

0 comments on commit 958880d

Please sign in to comment.