Files
blockly/tests/generators/loops2.xml

854 lines
55 KiB
XML

<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="procedures_defnoreturn" x="679" y="-10">
<mutation></mutation>
<title name="NAME">test count by</title>
<statement name="STACK">
<block type="variables_set" inline="false">
<title name="VAR">log</title>
<value name="VALUE">
<block type="text">
<title name="TEXT"></title>
</block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="TO">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="BY">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<statement name="DO">
<block type="text_append" inline="false">
<title name="VAR">log</title>
<value name="TEXT">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count up ints</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">log</title>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<title name="TEXT">1357</title>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">log</title>
<value name="VALUE">
<block type="text">
<title name="TEXT"></title>
</block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="TO">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="BY">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<statement name="DO">
<block type="text_append" inline="false">
<title name="VAR">log</title>
<value name="TEXT">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count down ints</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">log</title>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<title name="TEXT">8642</title>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="TO">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="BY">
<block type="math_number">
<title name="NUM">1.5</title>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count with floats</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="5"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">2.5</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">5.5</title>
</block>
</value>
<value name="ADD4">
<block type="math_number">
<title name="NUM">7</title>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="TO">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="BY">
<block type="math_arithmetic" inline="true">
<title name="OP">MINUS</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count up non-trivial ints</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="8"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">3</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
<value name="ADD4">
<block type="math_number">
<title name="NUM">5</title>
</block>
</value>
<value name="ADD5">
<block type="math_number">
<title name="NUM">6</title>
</block>
</value>
<value name="ADD6">
<block type="math_number">
<title name="NUM">7</title>
</block>
</value>
<value name="ADD7">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="TO">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="BY">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count down non-trivial ints</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">6</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">5</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0.5</title>
</block>
</value>
</block>
</value>
<value name="TO">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="BY">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count with floats</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="5"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">5.5</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">4.5</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">3.5</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">2.5</title>
</block>
</value>
<value name="ADD4">
<block type="math_number">
<title name="NUM">1.5</title>
</block>
</value>
</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="unittest_main" x="66" y="-2">
<statement name="DO">
<block type="procedures_callnoreturn">
<mutation name="test count"></mutation>
<next>
<block type="procedures_callnoreturn">
<mutation name="test count by"></mutation>
</block>
</next>
</block>
</statement>
</block>
<block type="procedures_defnoreturn" x="29" y="184">
<mutation></mutation>
<title name="NAME">test count</title>
<statement name="STACK">
<block type="variables_set" inline="false">
<title name="VAR">log</title>
<value name="VALUE">
<block type="text">
<title name="TEXT"></title>
</block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="TO">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<statement name="DO">
<block type="text_append" inline="false">
<title name="VAR">log</title>
<value name="TEXT">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count up</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">log</title>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<title name="TEXT">12345678</title>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">log</title>
<value name="VALUE">
<block type="text">
<title name="TEXT"></title>
</block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_number">
<title name="NUM">8</title>
</block>
</value>
<value name="TO">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<statement name="DO">
<block type="text_append" inline="false">
<title name="VAR">log</title>
<value name="TEXT">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count down</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">log</title>
</block>
</value>
<value name="EXPECTED">
<block type="text">
<title name="TEXT">87654321</title>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<value name="TO">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count up non-trivial</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">3</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
</block>
</value>
<next>
<block type="variables_set" inline="false">
<title name="VAR">loglist</title>
<value name="VALUE">
<block type="lists_create_empty"></block>
</value>
<next>
<block type="controls_for" inline="true">
<title name="VAR">x</title>
<value name="FROM">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">3</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
</block>
</value>
<value name="TO">
<block type="math_arithmetic" inline="true">
<title name="OP">ADD</title>
<value name="A">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
<value name="B">
<block type="math_number">
<title name="NUM">0</title>
</block>
</value>
</block>
</value>
<statement name="DO">
<block type="lists_setIndex" inline="true">
<mutation at="false"></mutation>
<title name="MODE">INSERT</title>
<title name="WHERE">LAST</title>
<value name="LIST">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="TO">
<block type="variables_get">
<title name="VAR">x</title>
</block>
</value>
</block>
</statement>
<next>
<block type="unittest_assertequals" inline="false">
<title name="MESSAGE">count down non-trivial</title>
<value name="ACTUAL">
<block type="variables_get">
<title name="VAR">loglist</title>
</block>
</value>
<value name="EXPECTED">
<block type="lists_create_with" inline="false">
<mutation items="4"></mutation>
<value name="ADD0">
<block type="math_number">
<title name="NUM">4</title>
</block>
</value>
<value name="ADD1">
<block type="math_number">
<title name="NUM">3</title>
</block>
</value>
<value name="ADD2">
<block type="math_number">
<title name="NUM">2</title>
</block>
</value>
<value name="ADD3">
<block type="math_number">
<title name="NUM">1</title>
</block>
</value>
</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>
</statement>
</block>
</xml>