diff options
Diffstat (limited to 'blockly/tests/generators/text.xml')
-rw-r--r-- | blockly/tests/generators/text.xml | 4094 |
1 files changed, 4094 insertions, 0 deletions
diff --git a/blockly/tests/generators/text.xml b/blockly/tests/generators/text.xml new file mode 100644 index 0000000..baf62d8 --- /dev/null +++ b/blockly/tests/generators/text.xml @@ -0,0 +1,4094 @@ +<xml xmlns="http://www.w3.org/1999/xhtml"> + <block type="unittest_main" x="13" y="13"> + <statement name="DO"> + <block type="procedures_callnoreturn"> + <mutation name="test length"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test empty"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test create"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test append"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test find simple"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test find complex"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test get simple"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test get complex"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test substring simple"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test substring complex"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test case"></mutation> + <next> + <block type="procedures_callnoreturn"> + <mutation name="test trim"></mutation> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="388"> + <mutation> + <arg name="test name"></arg> + </mutation> + <field name="NAME">check number of calls</field> + <comment pinned="false" h="69" w="256">Checks that the number of calls is one in order to confirm that a function was only called once.</comment> + <statement name="STACK"> + <block type="text_append"> + <field name="VAR">test name</field> + <value name="TEXT"> + <block type="text"> + <field name="TEXT">number of calls</field> + </block> + </value> + <next> + <block type="unittest_assertequals"> + <value name="MESSAGE"> + <block type="variables_get"> + <field name="VAR">test name</field> + </block> + </value> + <value name="ACTUAL"> + <block type="variables_get"> + <field name="VAR">number of calls</field> + </block> + </value> + <value name="EXPECTED"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="563"> + <field name="NAME">test create</field> + <comment pinned="false" h="80" w="160">Tests the "create text with" block with varying number of inputs.</comment> + <statement name="STACK"> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">no text</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="false"> + <mutation items="0"></mutation> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT"></field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create single</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="false"> + <mutation items="1"></mutation> + <value name="ADD0"> + <block type="text"> + <field name="TEXT">Hello</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">Hello</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create single number</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="false"> + <mutation items="1"></mutation> + <value name="ADD0"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">-1</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create double text</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="true"> + <mutation items="2"></mutation> + <value name="ADD0"> + <block type="text"> + <field name="TEXT">K</field> + </block> + </value> + <value name="ADD1"> + <block type="math_number"> + <field name="NUM">9</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">K9</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create double text numbers</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="true"> + <mutation items="2"></mutation> + <value name="ADD0"> + <block type="math_number"> + <field name="NUM">4</field> + </block> + </value> + <value name="ADD1"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">42</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create triple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="true"> + <mutation items="3"></mutation> + <value name="ADD0"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + <value name="ADD1"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + <value name="ADD2"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">create order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_join" inline="false"> + <mutation items="3"></mutation> + <value name="ADD0"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + <value name="ADD1"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="ADD2"> + <block type="text"> + <field name="TEXT">M</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">10M</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defreturn" x="13" y="1263"> + <mutation statements="false"></mutation> + <field name="NAME">get empty</field> + <comment pinned="false" h="80" w="160">Creates an empty string for use with the empty test.</comment> + <value name="RETURN"> + <block type="text"> + <field name="TEXT"></field> + </block> + </value> + </block> + <block type="procedures_defnoreturn" x="13" y="1338"> + <field name="NAME">test empty</field> + <comment pinned="false" h="80" w="160">Tests the "is empty" block".</comment> + <statement name="STACK"> + <block type="unittest_assertvalue" inline="false"> + <field name="EXPECTED">FALSE</field> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">not empty</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_isEmpty" inline="true"> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Google</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">empty</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_isEmpty" inline="true"> + <value name="VALUE"> + <block type="text"> + <field name="TEXT"></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">empty complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_isEmpty" inline="true"> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get empty"></mutation> + </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">empty order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_isEmpty" inline="true"> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="text"> + <field name="TEXT"></field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="1663"> + <field name="NAME">test length</field> + <comment pinned="false" h="80" w="160">Tests the "length" block.</comment> + <statement name="STACK"> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">zero length</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_length" inline="false"> + <value name="VALUE"> + <block type="text"> + <field name="TEXT"></field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">non-zero length</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_length" inline="false"> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Google</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="math_number"> + <field name="NUM">6</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">length order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_length" inline="false"> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="text"> + <field name="TEXT">car</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="1963"> + <field name="NAME">test append</field> + <comment pinned="false" h="80" w="160">Tests the "append text" block with different types of parameters.</comment> + <statement name="STACK"> + <block type="variables_set" inline="false"> + <field name="VAR">item</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Miserable</field> + </block> + </value> + <next> + <block type="text_append" inline="false"> + <field name="VAR">item</field> + <value name="TEXT"> + <block type="text"> + <field name="TEXT">Failure</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">append text</field> + </block> + </value> + <value name="ACTUAL"> + <block type="variables_get"> + <field name="VAR">item</field> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">MiserableFailure</field> + </block> + </value> + <next> + <block type="variables_set" inline="false"> + <field name="VAR">item</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">12</field> + </block> + </value> + <next> + <block type="text_append" inline="false"> + <field name="VAR">item</field> + <value name="TEXT"> + <block type="math_number"> + <field name="NUM">34</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">append number</field> + </block> + </value> + <value name="ACTUAL"> + <block type="variables_get"> + <field name="VAR">item</field> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">1234</field> + </block> + </value> + <next> + <block type="variables_set" inline="false"> + <field name="VAR">item</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Something </field> + </block> + </value> + <next> + <block type="text_append" inline="false"> + <field name="VAR">item</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="text"> + <field name="TEXT">Positive</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">append order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="variables_get"> + <field name="VAR">item</field> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">Something Positive</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="2438"> + <field name="NAME">test find simple</field> + <comment pinned="false" h="80" w="160">Tests the "find" block with a variable.</comment> + <statement name="STACK"> + <block type="variables_set" inline="false"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Banana</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find first simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find last simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">LAST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find none simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">Peel</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defreturn" x="13" y="2838"> + <field name="NAME">get fruit</field> + <comment pinned="false" h="80" w="160">Creates a string for use with the find test.</comment> + <statement name="STACK"> + <block type="math_change"> + <field name="VAR">number of calls</field> + <value name="DELTA"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </statement> + <value name="RETURN"> + <block type="text"> + <field name="TEXT">Banana</field> + </block> + </value> + </block> + <block type="procedures_defnoreturn" x="13" y="2938"> + <field name="NAME">test find complex</field> + <comment pinned="false" h="80" w="160">Tests the "find" block with a function call.</comment> + <statement name="STACK"> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find first complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find first complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find first order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find first order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find last complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">LAST</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find last complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find last order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">LAST</field> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">an</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find last order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find none complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">Peel</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find none complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">find none order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_indexOf"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get fruit"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="FIND"> + <block type="text"> + <field name="TEXT">Peel</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">find none order complex</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="4013"> + <field name="NAME">test get simple</field> + <comment pinned="false" h="80" w="160">Tests the "get letter" block with a variable.</comment> + <statement name="STACK"> + <block type="variables_set" inline="false"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Blockly</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get first simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">B</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get last simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">LAST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">y</field> + </block> + </value> + <next> + <block type="unittest_assertvalue" inline="false"> + <field name="EXPECTED">TRUE</field> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get random simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="logic_compare"> + <field name="OP">GT</field> + <value name="A"> + <block type="text_indexOf" inline="false"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">RANDOM</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get # simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">o</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get # order simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">o</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get #-end simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_END</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">k</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get #-end order simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_END</field> + <comment pinned="false" h="84" w="274">The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index.</comment> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">k</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defreturn" x="13" y="4838"> + <field name="NAME">get Blockly</field> + <comment pinned="false" h="80" w="160">Creates a string for use with the get test.</comment> + <statement name="STACK"> + <block type="math_change"> + <field name="VAR">number of calls</field> + <value name="DELTA"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </statement> + <value name="RETURN"> + <block type="text"> + <field name="TEXT">Blockly</field> + </block> + </value> + </block> + <block type="procedures_defnoreturn" x="13" y="4938"> + <field name="NAME">test get complex</field> + <comment pinned="false" h="80" w="160">Tests the "get letter" block with a function call.</comment> + <statement name="STACK"> + <block type="variables_set" inline="false"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Blockly</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get first complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">FIRST</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">B</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get first complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get first order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">FIRST</field> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">B</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get first order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get last complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">LAST</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">y</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get last complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get last order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">LAST</field> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">y</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get last order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertvalue" inline="false"> + <field name="EXPECTED">TRUE</field> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get random complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="logic_compare"> + <field name="OP">GT</field> + <value name="A"> + <block type="text_indexOf" inline="false"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">RANDOM</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get random complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertvalue" inline="false"> + <field name="EXPECTED">TRUE</field> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get random order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="logic_compare"> + <field name="OP">GT</field> + <value name="A"> + <block type="text_indexOf" inline="false"> + <field name="END">FIRST</field> + <value name="VALUE"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="FIND"> + <block type="text_charAt"> + <mutation at="false"></mutation> + <field name="WHERE">RANDOM</field> + <value name="VALUE"> + <block type="logic_ternary" inline="false"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">-1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get random order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get # complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="AT"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">o</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get # complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get # order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_START</field> + <value name="VALUE"> + <block type="logic_ternary" inline="false"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">o</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get # order complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get #-end complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_END</field> + <value name="VALUE"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="AT"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">k</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get #-end complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">get #-end order complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_charAt"> + <mutation at="true"></mutation> + <field name="WHERE">FROM_END</field> + <comment pinned="false" h="83" w="258">The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index.</comment> + <value name="VALUE"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get Blockly"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">k</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">get #-end order complex</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defreturn" x="13" y="6738"> + <field name="NAME">get numbers</field> + <comment pinned="false" h="80" w="160">Creates a string for use with the substring test.</comment> + <statement name="STACK"> + <block type="math_change"> + <field name="VAR">number of calls</field> + <value name="DELTA"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </statement> + <value name="RETURN"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + </block> + <block type="procedures_defnoreturn" x="13" y="6838"> + <field name="NAME">test substring simple</field> + <comment pinned="false" h="80" w="160">Tests the "get substring" block with a variable.</comment> + <statement name="STACK"> + <block type="variables_set" inline="false"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">23</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # simple order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT2"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">23</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">78</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end simple order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_END</field> + <comment pinned="false" h="81" w="266">The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index.</comment> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">78</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first-last simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="false"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # #-end simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">2345678</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end # simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">6</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">34</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first # simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="true"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">1234</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first #-end simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="true"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">12345678</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # last simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="false"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">6</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">789</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end last simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="false"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">789</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with # #-end simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with #-end # simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">8</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">8</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with # #-end math simple</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <comment pinned="false" h="94" w="320">Checks that the whole string is properly retrieved even if the value for start and end is not a simple number. This is especially important in generators where substring uses [x:length - y] for # #-end.</comment> + <value name="STRING"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="AT1"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="8388"> + <field name="NAME">test substring complex</field> + <comment pinned="false" h="80" w="160">Tests the "get substring" block with a function call.</comment> + <statement name="STACK"> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">23</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring # complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # complex order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT1"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT2"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">23</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring # complex order</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_END</field> + <comment pinned="false" h="83" w="259">The order for index for #-end is addition because this will catch errors in generators where most perform the operation ... - index.</comment> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">78</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring #-end complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end order order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="logic_ternary"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + <value name="AT1"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">78</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring #-end order order</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first-last</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="false"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring first-last</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # #-end complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">2345678</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring # #-end complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end # complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">6</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">34</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring #-end # complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first # complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="true"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">3</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">1234</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring first # complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring first #-end complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="false" at2="true"></mutation> + <field name="WHERE1">FIRST</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">1</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">12345678</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring first #-end complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring # last complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="false"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">6</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">789</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring # last complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring #-end last complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="false"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">LAST</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">2</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">789</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring #-end last complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with # #-end complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring all with # #-end complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with #-end # complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_END</field> + <field name="WHERE2">FROM_START</field> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">8</field> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">8</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring all with #-end # complex</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">number of calls</field> + <value name="VALUE"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">substring all with # #-end math complex</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_getSubstring"> + <mutation at1="true" at2="true"></mutation> + <field name="WHERE1">FROM_START</field> + <field name="WHERE2">FROM_END</field> + <comment pinned="false" h="92" w="323">Checks that the whole string is properly retrieved even if the value for start and end is not a simple number. This is especially important in generators where substring uses [x:length - y] for # #-end.</comment> + <value name="STRING"> + <block type="procedures_callreturn"> + <mutation name="get numbers"></mutation> + </block> + </value> + <value name="AT1"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="AT2"> + <block type="math_arithmetic"> + <field name="OP">ADD</field> + <value name="A"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + <value name="B"> + <block type="unittest_adjustindex"> + <value name="INDEX"> + <block type="math_number"> + <field name="NUM">0</field> + </block> + </value> + </block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">123456789</field> + </block> + </value> + <next> + <block type="procedures_callnoreturn" inline="true"> + <mutation name="check number of calls"> + <arg name="test name"></arg> + </mutation> + <value name="ARG0"> + <block type="text"> + <field name="TEXT">substring all with # #-end math complex</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="10838"> + <field name="NAME">test case</field> + <comment pinned="false" h="80" w="160">Tests the "change casing" block.</comment> + <statement name="STACK"> + <block type="variables_set"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Hello World</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">uppercase</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">UPPERCASE</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">HELLO WORLD</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">uppercase order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">UPPERCASE</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">HELLO WORLD</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">Hello World</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">lowercase</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">LOWERCASE</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">hello world</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">lowercase order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">LOWERCASE</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">hello world</field> + </block> + </value> + <next> + <block type="variables_set"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT">heLLo WorlD</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">titlecase</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">TITLECASE</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">Hello World</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">titlecase order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_changeCase" inline="false"> + <field name="CASE">TITLECASE</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">Hello World</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> + <block type="procedures_defnoreturn" x="13" y="11488"> + <field name="NAME">test trim</field> + <comment pinned="false" h="80" w="160">Tests the "trim" block.</comment> + <statement name="STACK"> + <block type="variables_set"> + <field name="VAR">text</field> + <value name="VALUE"> + <block type="text"> + <field name="TEXT"> abc def </field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim both</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">BOTH</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">abc def</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim both order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">BOTH</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">abc def</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim left</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">LEFT</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">abc def </field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim left order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">LEFT</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT">abc def </field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim right</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">RIGHT</field> + <value name="TEXT"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT"> abc def</field> + </block> + </value> + <next> + <block type="unittest_assertequals" inline="false"> + <value name="MESSAGE"> + <block type="text"> + <field name="TEXT">trim right order</field> + </block> + </value> + <value name="ACTUAL"> + <block type="text_trim" inline="false"> + <field name="MODE">RIGHT</field> + <value name="TEXT"> + <block type="logic_ternary" inline="true"> + <value name="IF"> + <block type="logic_boolean"> + <field name="BOOL">TRUE</field> + </block> + </value> + <value name="THEN"> + <block type="variables_get"> + <field name="VAR">text</field> + </block> + </value> + <value name="ELSE"> + <block type="logic_null"></block> + </value> + </block> + </value> + </block> + </value> + <value name="EXPECTED"> + <block type="text"> + <field name="TEXT"> abc def</field> + </block> + </value> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </next> + </block> + </statement> + </block> +</xml>
\ No newline at end of file |