123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- <xml xmlns="http://www.w3.org/1999/xhtml">
- <block type="unittest_main" x="0" y="1">
- <statement name="DO">
- <block type="procedures_callnoreturn">
- <mutation name="test procedure"></mutation>
- <next>
- <block type="procedures_callnoreturn">
- <mutation name="test function"></mutation>
- <next>
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">test recurse</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="procedures_callreturn" inline="false">
- <mutation name="recurse">
- <arg name="n"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_number">
- <field name="NUM">3</field>
- </block>
- </value>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="text">
- <field name="TEXT">-1-2-1-3-1-2-1-</field>
- </block>
- </value>
- </block>
- </next>
- </block>
- </next>
- </block>
- </statement>
- </block>
- <block type="procedures_defnoreturn" x="-3" y="249">
- <field name="NAME">test procedure</field>
- <statement name="STACK">
- <block type="procedures_callnoreturn" inline="false">
- <mutation name="procedure 1">
- <arg name="proc x"></arg>
- <arg name="proc y"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_number">
- <field name="NUM">8</field>
- </block>
- </value>
- <value name="ARG1">
- <block type="math_number">
- <field name="NUM">2</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">procedure with global</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="variables_get">
- <field name="VAR">proc z</field>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="math_number">
- <field name="NUM">4</field>
- </block>
- </value>
- <next>
- <block type="variables_set" inline="false">
- <field name="VAR">proc w</field>
- <value name="VALUE">
- <block type="logic_boolean">
- <field name="BOOL">FALSE</field>
- </block>
- </value>
- <next>
- <block type="procedures_callnoreturn" inline="false">
- <mutation name="procedure 2">
- <arg name="proc x"></arg>
- </mutation>
- <value name="ARG0">
- <block type="logic_boolean">
- <field name="BOOL">FALSE</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertvalue" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">procedure no return</field>
- </block>
- </value>
- <field name="EXPECTED">TRUE</field>
- <value name="ACTUAL">
- <block type="variables_get">
- <field name="VAR">proc w</field>
- </block>
- </value>
- <next>
- <block type="variables_set" inline="false">
- <field name="VAR">proc w</field>
- <value name="VALUE">
- <block type="logic_boolean">
- <field name="BOOL">FALSE</field>
- </block>
- </value>
- <next>
- <block type="procedures_callnoreturn" inline="false">
- <mutation name="procedure 2">
- <arg name="proc x"></arg>
- </mutation>
- <value name="ARG0">
- <block type="logic_boolean">
- <field name="BOOL">TRUE</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertvalue" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">procedure return</field>
- </block>
- </value>
- <field name="EXPECTED">FALSE</field>
- <value name="ACTUAL">
- <block type="variables_get">
- <field name="VAR">proc w</field>
- </block>
- </value>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </statement>
- </block>
- <block type="procedures_defnoreturn" x="302" y="277">
- <mutation>
- <arg name="proc x"></arg>
- <arg name="proc y"></arg>
- </mutation>
- <field name="NAME">procedure 1</field>
- <statement name="STACK">
- <block type="variables_set" inline="false">
- <field name="VAR">proc z</field>
- <value name="VALUE">
- <block type="math_arithmetic">
- <field name="OP">DIVIDE</field>
- <value name="A">
- <block type="variables_get">
- <field name="VAR">proc x</field>
- </block>
- </value>
- <value name="B">
- <block type="variables_get">
- <field name="VAR">proc y</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- </statement>
- </block>
- <block type="procedures_defnoreturn" x="307" y="435">
- <mutation>
- <arg name="proc x"></arg>
- </mutation>
- <field name="NAME">procedure 2</field>
- <statement name="STACK">
- <block type="procedures_ifreturn">
- <mutation value="0"></mutation>
- <value name="CONDITION">
- <block type="variables_get">
- <field name="VAR">proc x</field>
- </block>
- </value>
- <next>
- <block type="variables_set" inline="false">
- <field name="VAR">proc w</field>
- <value name="VALUE">
- <block type="logic_boolean">
- <field name="BOOL">TRUE</field>
- </block>
- </value>
- </block>
- </next>
- </block>
- </statement>
- </block>
- <block type="procedures_defnoreturn" x="-2" y="731">
- <field name="NAME">test function</field>
- <statement name="STACK">
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function with arguments</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="procedures_callreturn" inline="false">
- <mutation name="function 1">
- <arg name="func x"></arg>
- <arg name="func y"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_number">
- <field name="NUM">2</field>
- </block>
- </value>
- <value name="ARG1">
- <block type="math_number">
- <field name="NUM">3</field>
- </block>
- </value>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="math_number">
- <field name="NUM">-1</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function with side effect</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="variables_get">
- <field name="VAR">func z</field>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="text">
- <field name="TEXT">side effect</field>
- </block>
- </value>
- <next>
- <block type="variables_set" inline="false">
- <field name="VAR">func a</field>
- <value name="VALUE">
- <block type="text">
- <field name="TEXT">unchanged</field>
- </block>
- </value>
- <next>
- <block type="variables_set" inline="false">
- <field name="VAR">func c</field>
- <value name="VALUE">
- <block type="text">
- <field name="TEXT">global</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function with global</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="procedures_callreturn" inline="false">
- <mutation name="function 2">
- <arg name="func a"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_number">
- <field name="NUM">2</field>
- </block>
- </value>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="text">
- <field name="TEXT">3global</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertequals" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function with scope</field>
- </block>
- </value>
- <value name="ACTUAL">
- <block type="variables_get">
- <field name="VAR">func a</field>
- </block>
- </value>
- <value name="EXPECTED">
- <block type="text">
- <field name="TEXT">unchanged</field>
- </block>
- </value>
- <next>
- <block type="unittest_assertvalue" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function return</field>
- </block>
- </value>
- <field name="EXPECTED">TRUE</field>
- <value name="ACTUAL">
- <block type="procedures_callreturn" inline="false">
- <mutation name="function 3">
- <arg name="func a"></arg>
- </mutation>
- <value name="ARG0">
- <block type="logic_boolean">
- <field name="BOOL">TRUE</field>
- </block>
- </value>
- </block>
- </value>
- <next>
- <block type="unittest_assertvalue" inline="false">
- <value name="MESSAGE">
- <block type="text">
- <field name="TEXT">function no return</field>
- </block>
- </value>
- <field name="EXPECTED">FALSE</field>
- <value name="ACTUAL">
- <block type="procedures_callreturn" inline="false">
- <mutation name="function 3">
- <arg name="func a"></arg>
- </mutation>
- <value name="ARG0">
- <block type="logic_boolean">
- <field name="BOOL">FALSE</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </next>
- </block>
- </statement>
- </block>
- <block type="procedures_defreturn" inline="false" x="-3" y="1384">
- <mutation>
- <arg name="func x"></arg>
- <arg name="func y"></arg>
- </mutation>
- <field name="NAME">function 1</field>
- <statement name="STACK">
- <block type="variables_set" inline="false">
- <field name="VAR">func z</field>
- <value name="VALUE">
- <block type="text">
- <field name="TEXT">side effect</field>
- </block>
- </value>
- </block>
- </statement>
- <value name="RETURN">
- <block type="math_arithmetic">
- <field name="OP">MINUS</field>
- <value name="A">
- <block type="variables_get">
- <field name="VAR">func x</field>
- </block>
- </value>
- <value name="B">
- <block type="variables_get">
- <field name="VAR">func y</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- <block type="procedures_defreturn" inline="false" x="-1" y="1503">
- <mutation>
- <arg name="func a"></arg>
- </mutation>
- <field name="NAME">function 2</field>
- <statement name="STACK">
- <block type="math_change" inline="false">
- <field name="VAR">func a</field>
- <value name="DELTA">
- <block type="math_number">
- <field name="NUM">1</field>
- </block>
- </value>
- </block>
- </statement>
- <value name="RETURN">
- <block type="text_join" inline="false">
- <mutation items="2"></mutation>
- <value name="ADD0">
- <block type="variables_get">
- <field name="VAR">func a</field>
- </block>
- </value>
- <value name="ADD1">
- <block type="variables_get">
- <field name="VAR">func c</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- <block type="procedures_defreturn" inline="false" x="0" y="1655">
- <mutation>
- <arg name="func a"></arg>
- </mutation>
- <field name="NAME">function 3</field>
- <statement name="STACK">
- <block type="procedures_ifreturn">
- <mutation value="1"></mutation>
- <value name="CONDITION">
- <block type="variables_get">
- <field name="VAR">func a</field>
- </block>
- </value>
- <value name="VALUE">
- <block type="logic_boolean">
- <field name="BOOL">TRUE</field>
- </block>
- </value>
- </block>
- </statement>
- <value name="RETURN">
- <block type="logic_boolean">
- <field name="BOOL">FALSE</field>
- </block>
- </value>
- </block>
- <block type="procedures_defreturn" inline="false" x="0" y="1789">
- <mutation>
- <arg name="n"></arg>
- </mutation>
- <field name="NAME">recurse</field>
- <statement name="STACK">
- <block type="controls_if" inline="false">
- <mutation else="1"></mutation>
- <value name="IF0">
- <block type="logic_compare">
- <field name="OP">GT</field>
- <value name="A">
- <block type="variables_get">
- <field name="VAR">n</field>
- </block>
- </value>
- <value name="B">
- <block type="math_number">
- <field name="NUM">0</field>
- </block>
- </value>
- </block>
- </value>
- <statement name="DO0">
- <block type="variables_set" inline="false">
- <field name="VAR">text</field>
- <value name="VALUE">
- <block type="text_join" inline="false">
- <mutation items="3"></mutation>
- <value name="ADD0">
- <block type="procedures_callreturn" inline="false">
- <mutation name="recurse">
- <arg name="n"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_arithmetic">
- <field name="OP">MINUS</field>
- <value name="A">
- <block type="variables_get">
- <field name="VAR">n</field>
- </block>
- </value>
- <value name="B">
- <block type="math_number">
- <field name="NUM">1</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- </value>
- <value name="ADD1">
- <block type="variables_get">
- <field name="VAR">n</field>
- </block>
- </value>
- <value name="ADD2">
- <block type="procedures_callreturn" inline="false">
- <mutation name="recurse">
- <arg name="n"></arg>
- </mutation>
- <value name="ARG0">
- <block type="math_arithmetic">
- <field name="OP">MINUS</field>
- <value name="A">
- <block type="variables_get">
- <field name="VAR">n</field>
- </block>
- </value>
- <value name="B">
- <block type="math_number">
- <field name="NUM">1</field>
- </block>
- </value>
- </block>
- </value>
- </block>
- </value>
- </block>
- </value>
- </block>
- </statement>
- <statement name="ELSE">
- <block type="variables_set" inline="false">
- <field name="VAR">text</field>
- <value name="VALUE">
- <block type="text">
- <field name="TEXT">-</field>
- </block>
- </value>
- </block>
- </statement>
- </block>
- </statement>
- <value name="RETURN">
- <block type="variables_get">
- <field name="VAR">text</field>
- </block>
- </value>
- </block>
- </xml>
|