loops1.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <xml xmlns="http://www.w3.org/1999/xhtml">
  2. <block type="unittest_main" x="33" y="140">
  3. <statement name="DO">
  4. <block type="procedures_callnoreturn">
  5. <mutation name="test repeat"></mutation>
  6. <next>
  7. <block type="procedures_callnoreturn">
  8. <mutation name="test while"></mutation>
  9. <next>
  10. <block type="procedures_callnoreturn">
  11. <mutation name="test foreach"></mutation>
  12. </block>
  13. </next>
  14. </block>
  15. </next>
  16. </block>
  17. </statement>
  18. </block>
  19. <block type="procedures_defnoreturn" x="31" y="296">
  20. <mutation></mutation>
  21. <field name="NAME">test foreach</field>
  22. <statement name="STACK">
  23. <block type="variables_set" inline="false">
  24. <field name="VAR">log</field>
  25. <value name="VALUE">
  26. <block type="text">
  27. <field name="TEXT"></field>
  28. </block>
  29. </value>
  30. <next>
  31. <block type="controls_forEach" inline="false">
  32. <field name="VAR">x</field>
  33. <value name="LIST">
  34. <block type="lists_create_with" inline="false">
  35. <mutation items="3"></mutation>
  36. <value name="ADD0">
  37. <block type="text">
  38. <field name="TEXT">a</field>
  39. </block>
  40. </value>
  41. <value name="ADD1">
  42. <block type="text">
  43. <field name="TEXT">b</field>
  44. </block>
  45. </value>
  46. <value name="ADD2">
  47. <block type="text">
  48. <field name="TEXT">c</field>
  49. </block>
  50. </value>
  51. </block>
  52. </value>
  53. <statement name="DO">
  54. <block type="text_append" inline="false">
  55. <field name="VAR">log</field>
  56. <value name="TEXT">
  57. <block type="variables_get">
  58. <field name="VAR">x</field>
  59. </block>
  60. </value>
  61. </block>
  62. </statement>
  63. <next>
  64. <block type="unittest_assertequals" inline="false">
  65. <value name="MESSAGE">
  66. <block type="text">
  67. <field name="TEXT">for loop</field>
  68. </block>
  69. </value>
  70. <value name="ACTUAL">
  71. <block type="variables_get">
  72. <field name="VAR">log</field>
  73. </block>
  74. </value>
  75. <value name="EXPECTED">
  76. <block type="text">
  77. <field name="TEXT">abc</field>
  78. </block>
  79. </value>
  80. </block>
  81. </next>
  82. </block>
  83. </next>
  84. </block>
  85. </statement>
  86. </block>
  87. <block type="procedures_defnoreturn" x="30" y="624">
  88. <mutation></mutation>
  89. <field name="NAME">test while</field>
  90. <statement name="STACK">
  91. <block type="controls_whileUntil" inline="false">
  92. <field name="MODE">WHILE</field>
  93. <value name="BOOL">
  94. <block type="logic_boolean">
  95. <field name="BOOL">FALSE</field>
  96. </block>
  97. </value>
  98. <statement name="DO">
  99. <block type="unittest_fail">
  100. <field name="MESSAGE">while 0</field>
  101. </block>
  102. </statement>
  103. <next>
  104. <block type="controls_whileUntil" inline="false">
  105. <field name="MODE">UNTIL</field>
  106. <value name="BOOL">
  107. <block type="logic_boolean">
  108. <field name="BOOL">TRUE</field>
  109. </block>
  110. </value>
  111. <statement name="DO">
  112. <block type="unittest_fail">
  113. <field name="MESSAGE">until 0</field>
  114. </block>
  115. </statement>
  116. <next>
  117. <block type="variables_set" inline="false">
  118. <field name="VAR">count</field>
  119. <value name="VALUE">
  120. <block type="math_number">
  121. <field name="NUM">1</field>
  122. </block>
  123. </value>
  124. <next>
  125. <block type="controls_whileUntil" inline="false">
  126. <field name="MODE">WHILE</field>
  127. <value name="BOOL">
  128. <block type="logic_compare">
  129. <field name="OP">NEQ</field>
  130. <value name="A">
  131. <block type="variables_get">
  132. <field name="VAR">count</field>
  133. </block>
  134. </value>
  135. <value name="B">
  136. <block type="math_number">
  137. <field name="NUM">10</field>
  138. </block>
  139. </value>
  140. </block>
  141. </value>
  142. <statement name="DO">
  143. <block type="math_change" inline="false">
  144. <field name="VAR">count</field>
  145. <value name="DELTA">
  146. <block type="math_number">
  147. <field name="NUM">1</field>
  148. </block>
  149. </value>
  150. </block>
  151. </statement>
  152. <next>
  153. <block type="unittest_assertequals" inline="false">
  154. <value name="MESSAGE">
  155. <block type="text">
  156. <field name="TEXT">while 10</field>
  157. </block>
  158. </value>
  159. <value name="ACTUAL">
  160. <block type="variables_get">
  161. <field name="VAR">count</field>
  162. </block>
  163. </value>
  164. <value name="EXPECTED">
  165. <block type="math_number">
  166. <field name="NUM">10</field>
  167. </block>
  168. </value>
  169. <next>
  170. <block type="variables_set" inline="false">
  171. <field name="VAR">count</field>
  172. <value name="VALUE">
  173. <block type="math_number">
  174. <field name="NUM">1</field>
  175. </block>
  176. </value>
  177. <next>
  178. <block type="controls_whileUntil" inline="false">
  179. <field name="MODE">UNTIL</field>
  180. <value name="BOOL">
  181. <block type="logic_compare">
  182. <field name="OP">EQ</field>
  183. <value name="A">
  184. <block type="variables_get">
  185. <field name="VAR">count</field>
  186. </block>
  187. </value>
  188. <value name="B">
  189. <block type="math_number">
  190. <field name="NUM">10</field>
  191. </block>
  192. </value>
  193. </block>
  194. </value>
  195. <statement name="DO">
  196. <block type="math_change" inline="false">
  197. <field name="VAR">count</field>
  198. <value name="DELTA">
  199. <block type="math_number">
  200. <field name="NUM">1</field>
  201. </block>
  202. </value>
  203. </block>
  204. </statement>
  205. <next>
  206. <block type="unittest_assertequals" inline="false">
  207. <value name="MESSAGE">
  208. <block type="text">
  209. <field name="TEXT">until 10</field>
  210. </block>
  211. </value>
  212. <value name="ACTUAL">
  213. <block type="variables_get">
  214. <field name="VAR">count</field>
  215. </block>
  216. </value>
  217. <value name="EXPECTED">
  218. <block type="math_number">
  219. <field name="NUM">10</field>
  220. </block>
  221. </value>
  222. </block>
  223. </next>
  224. </block>
  225. </next>
  226. </block>
  227. </next>
  228. </block>
  229. </next>
  230. </block>
  231. </next>
  232. </block>
  233. </next>
  234. </block>
  235. </next>
  236. </block>
  237. </statement>
  238. </block>
  239. <block type="procedures_defnoreturn" x="397" y="628">
  240. <mutation></mutation>
  241. <field name="NAME">test repeat</field>
  242. <statement name="STACK">
  243. <block type="variables_set" inline="false">
  244. <field name="VAR">count</field>
  245. <value name="VALUE">
  246. <block type="math_number">
  247. <field name="NUM">0</field>
  248. </block>
  249. </value>
  250. <next>
  251. <block type="controls_repeat_ext" inline="true">
  252. <value name="TIMES">
  253. <block type="math_number">
  254. <field name="NUM">10</field>
  255. </block>
  256. </value>
  257. <statement name="DO">
  258. <block type="math_change" inline="false">
  259. <field name="VAR">count</field>
  260. <value name="DELTA">
  261. <block type="math_number">
  262. <field name="NUM">1</field>
  263. </block>
  264. </value>
  265. </block>
  266. </statement>
  267. <next>
  268. <block type="unittest_assertequals" inline="false">
  269. <value name="MESSAGE">
  270. <block type="text">
  271. <field name="TEXT">repeat 10</field>
  272. </block>
  273. </value>
  274. <value name="ACTUAL">
  275. <block type="variables_get">
  276. <field name="VAR">count</field>
  277. </block>
  278. </value>
  279. <value name="EXPECTED">
  280. <block type="math_number">
  281. <field name="NUM">10</field>
  282. </block>
  283. </value>
  284. </block>
  285. </next>
  286. </block>
  287. </next>
  288. </block>
  289. </statement>
  290. </block>
  291. </xml>