File "functions.xml"

Full path: /usr/home/mndrn/domains/mndrn.ru/public_html/block-hill/blockly/tests/generators/functions.xml
File size: 20.86 KiB (21364 bytes)
MIME-type: text/plain
Charset: utf-8

Download   Open   Back

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

PHP File Manager