Adding unit tests for ifelse block.

This commit is contained in:
Andrew n marshall
2017-01-09 11:05:57 -08:00
parent 51868a2162
commit 827ec93ab4

View File

@@ -1,5 +1,5 @@
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="unittest_main" x="-4" y="-12">
<block type="unittest_main" x="-13" y="-13">
<statement name="DO">
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
@@ -65,16 +65,21 @@
<mutation name="test if"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test equalities"></mutation>
<mutation name="test ifelse"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test and"></mutation>
<mutation name="test equalities"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test or"></mutation>
<mutation name="test and"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test ternary"></mutation>
<mutation name="test or"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test ternary"></mutation>
</block>
</next>
</block>
</next>
</block>
@@ -94,7 +99,7 @@
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="385" y="-3">
<block type="procedures_defnoreturn" x="387" y="-13">
<field name="NAME">test if</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
@@ -326,7 +331,109 @@
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-7" y="384">
<block type="procedures_defnoreturn" x="712" y="-13">
<field name="NAME">test ifelse</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="variables_set">
<field name="VAR">ok</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="controls_ifelse">
<value name="IF0">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
<statement name="DO0">
<block type="variables_set">
<field name="VAR">ok</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</statement>
<statement name="ELSE">
<block type="unittest_fail">
<field name="MESSAGE">ifelse true</field>
</block>
</statement>
<next>
<block type="unittest_assertvalue">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">ifelse true</field>
</block>
</value>
<value name="ACTUAL">
<block type="variables_get">
<field name="VAR">ok</field>
</block>
</value>
<next>
<block type="variables_set">
<field name="VAR">ok</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="controls_ifelse">
<value name="IF0">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<statement name="DO0">
<block type="unittest_fail">
<field name="MESSAGE">ifelse false</field>
</block>
</statement>
<statement name="ELSE">
<block type="variables_set">
<field name="VAR">ok</field>
<value name="VALUE">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertvalue">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">ifelse false</field>
</block>
</value>
<value name="ACTUAL">
<block type="variables_get">
<field name="VAR">ok</field>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-12" y="412">
<field name="NAME">test equalities</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
@@ -630,110 +737,6 @@
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-5" y="1200">
<field name="NAME">test or</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or true/true</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or false/true</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or true/false</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">FALSE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or false/false</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="385" y="1208">
<field name="NAME">test and</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
@@ -838,7 +841,111 @@
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="3" y="1527">
<block type="procedures_defnoreturn" x="-13" y="1238">
<field name="NAME">test or</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or true/true</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or false/true</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">TRUE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or true/false</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">TRUE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
<next>
<block type="unittest_assertvalue" inline="false">
<field name="EXPECTED">FALSE</field>
<value name="MESSAGE">
<block type="text">
<field name="TEXT">Or false/false</field>
</block>
</value>
<value name="ACTUAL">
<block type="logic_operation">
<field name="OP">OR</field>
<value name="A">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
<value name="B">
<block type="logic_boolean">
<field name="BOOL">FALSE</field>
</block>
</value>
</block>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="-13" y="1563">
<field name="NAME">test ternary</field>
<comment pinned="false" h="80" w="160">Describe this function...</comment>
<statement name="STACK">