Skip to content
Open
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
24 changes: 24 additions & 0 deletions tests/cql/CqlConditionalOperatorsTest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
<expression>if 10 = null then 5 else 10</expression>
<output>10</output>
</test>
<test name="IfNullCondition" version="1.0">
<!-- null condition is interpreted as false, so the else branch is taken -->
<expression>if null as Boolean then 5 else 10</expression>
<output>10</output>
</test>
<test name="IfNested" version="1.0">
<expression>if true then (if false then 1 else 2) else 3</expression>
<output>2</output>
</test>
</group>
<group name="standard case" version="1.0">
<capability code="logical-operators"/>
Expand Down Expand Up @@ -73,6 +82,11 @@
</expression>
<output>15</output>
</test>
<test name="StandardCaseNullCondition" version="1.0">
<!-- a when condition that evaluates to null is interpreted as false -->
<expression>case when null as Boolean then 1 else 2 end</expression>
<output>2</output>
</test>
</group>
<group name="selected case" version="1.0">
<capability code="logical-operators"/>
Expand Down Expand Up @@ -117,5 +131,15 @@
</expression>
<output>5</output>
</test>
<test name="SelectedCaseNullComparand" version="1.0">
<!-- a null comparand compares equal to nothing, so the else result is returned -->
<expression>case (null as Integer) when 5 then 12 when 10 then 15 else 0 end</expression>
<output>0</output>
</test>
<test name="SelectedCaseNullWhen" version="1.0">
<!-- a null case item does not compare equal to the comparand -->
<expression>case 5 when (null as Integer) then 12 when 5 then 99 else 0 end</expression>
<output>99</output>
</test>
</group>
</tests>
Loading