loops3.xml 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. <xml xmlns="http://www.w3.org/1999/xhtml">
  2. <block type="unittest_main" x="19" y="106">
  3. <statement name="DO">
  4. <block type="procedures_callnoreturn">
  5. <mutation name="test break"></mutation>
  6. <next>
  7. <block type="procedures_callnoreturn">
  8. <mutation name="test continue"></mutation>
  9. </block>
  10. </next>
  11. </block>
  12. </statement>
  13. </block>
  14. <block type="procedures_defnoreturn" x="13" y="300">
  15. <field name="NAME">test continue</field>
  16. <statement name="STACK">
  17. <block type="variables_set" inline="false">
  18. <field name="VAR">log</field>
  19. <value name="VALUE">
  20. <block type="text">
  21. <field name="TEXT"></field>
  22. </block>
  23. </value>
  24. <next>
  25. <block type="variables_set" inline="false">
  26. <field name="VAR">count</field>
  27. <value name="VALUE">
  28. <block type="math_number">
  29. <field name="NUM">0</field>
  30. </block>
  31. </value>
  32. <next>
  33. <block type="controls_whileUntil" inline="false">
  34. <field name="MODE">WHILE</field>
  35. <value name="BOOL">
  36. <block type="logic_compare">
  37. <field name="OP">NEQ</field>
  38. <value name="A">
  39. <block type="variables_get">
  40. <field name="VAR">count</field>
  41. </block>
  42. </value>
  43. <value name="B">
  44. <block type="math_number">
  45. <field name="NUM">8</field>
  46. </block>
  47. </value>
  48. </block>
  49. </value>
  50. <statement name="DO">
  51. <block type="math_change" inline="false">
  52. <field name="VAR">count</field>
  53. <value name="DELTA">
  54. <block type="math_number">
  55. <field name="NUM">1</field>
  56. </block>
  57. </value>
  58. <next>
  59. <block type="controls_if" inline="false">
  60. <value name="IF0">
  61. <block type="logic_compare">
  62. <field name="OP">EQ</field>
  63. <value name="A">
  64. <block type="variables_get">
  65. <field name="VAR">count</field>
  66. </block>
  67. </value>
  68. <value name="B">
  69. <block type="math_number">
  70. <field name="NUM">5</field>
  71. </block>
  72. </value>
  73. </block>
  74. </value>
  75. <statement name="DO0">
  76. <block type="controls_flow_statements">
  77. <field name="FLOW">CONTINUE</field>
  78. </block>
  79. </statement>
  80. <next>
  81. <block type="text_append" inline="false">
  82. <field name="VAR">log</field>
  83. <value name="TEXT">
  84. <block type="variables_get">
  85. <field name="VAR">count</field>
  86. </block>
  87. </value>
  88. </block>
  89. </next>
  90. </block>
  91. </next>
  92. </block>
  93. </statement>
  94. <next>
  95. <block type="unittest_assertequals" inline="false">
  96. <value name="MESSAGE">
  97. <block type="text">
  98. <field name="TEXT">while continue</field>
  99. </block>
  100. </value>
  101. <value name="ACTUAL">
  102. <block type="variables_get">
  103. <field name="VAR">log</field>
  104. </block>
  105. </value>
  106. <value name="EXPECTED">
  107. <block type="text">
  108. <field name="TEXT">1234678</field>
  109. </block>
  110. </value>
  111. <next>
  112. <block type="variables_set" inline="false">
  113. <field name="VAR">log</field>
  114. <value name="VALUE">
  115. <block type="text">
  116. <field name="TEXT"></field>
  117. </block>
  118. </value>
  119. <next>
  120. <block type="variables_set" inline="false">
  121. <field name="VAR">count</field>
  122. <value name="VALUE">
  123. <block type="math_number">
  124. <field name="NUM">0</field>
  125. </block>
  126. </value>
  127. <next>
  128. <block type="controls_whileUntil" inline="false">
  129. <field name="MODE">UNTIL</field>
  130. <value name="BOOL">
  131. <block type="logic_compare">
  132. <field name="OP">EQ</field>
  133. <value name="A">
  134. <block type="variables_get">
  135. <field name="VAR">count</field>
  136. </block>
  137. </value>
  138. <value name="B">
  139. <block type="math_number">
  140. <field name="NUM">8</field>
  141. </block>
  142. </value>
  143. </block>
  144. </value>
  145. <statement name="DO">
  146. <block type="math_change" inline="false">
  147. <field name="VAR">count</field>
  148. <value name="DELTA">
  149. <block type="math_number">
  150. <field name="NUM">1</field>
  151. </block>
  152. </value>
  153. <next>
  154. <block type="controls_if" inline="false">
  155. <value name="IF0">
  156. <block type="logic_compare">
  157. <field name="OP">EQ</field>
  158. <value name="A">
  159. <block type="variables_get">
  160. <field name="VAR">count</field>
  161. </block>
  162. </value>
  163. <value name="B">
  164. <block type="math_number">
  165. <field name="NUM">5</field>
  166. </block>
  167. </value>
  168. </block>
  169. </value>
  170. <statement name="DO0">
  171. <block type="controls_flow_statements">
  172. <field name="FLOW">CONTINUE</field>
  173. </block>
  174. </statement>
  175. <next>
  176. <block type="text_append" inline="false">
  177. <field name="VAR">log</field>
  178. <value name="TEXT">
  179. <block type="variables_get">
  180. <field name="VAR">count</field>
  181. </block>
  182. </value>
  183. </block>
  184. </next>
  185. </block>
  186. </next>
  187. </block>
  188. </statement>
  189. <next>
  190. <block type="unittest_assertequals" inline="false">
  191. <value name="MESSAGE">
  192. <block type="text">
  193. <field name="TEXT">until continue</field>
  194. </block>
  195. </value>
  196. <value name="ACTUAL">
  197. <block type="variables_get">
  198. <field name="VAR">log</field>
  199. </block>
  200. </value>
  201. <value name="EXPECTED">
  202. <block type="text">
  203. <field name="TEXT">1234678</field>
  204. </block>
  205. </value>
  206. <next>
  207. <block type="variables_set" inline="false">
  208. <field name="VAR">log</field>
  209. <value name="VALUE">
  210. <block type="text">
  211. <field name="TEXT"></field>
  212. </block>
  213. </value>
  214. <next>
  215. <block type="controls_for">
  216. <field name="VAR">x</field>
  217. <value name="FROM">
  218. <block type="math_number">
  219. <field name="NUM">1</field>
  220. </block>
  221. </value>
  222. <value name="TO">
  223. <block type="math_number">
  224. <field name="NUM">8</field>
  225. </block>
  226. </value>
  227. <statement name="DO">
  228. <block type="controls_if" inline="false">
  229. <value name="IF0">
  230. <block type="logic_compare">
  231. <field name="OP">EQ</field>
  232. <value name="A">
  233. <block type="variables_get">
  234. <field name="VAR">x</field>
  235. </block>
  236. </value>
  237. <value name="B">
  238. <block type="math_number">
  239. <field name="NUM">5</field>
  240. </block>
  241. </value>
  242. </block>
  243. </value>
  244. <statement name="DO0">
  245. <block type="controls_flow_statements">
  246. <field name="FLOW">CONTINUE</field>
  247. </block>
  248. </statement>
  249. <next>
  250. <block type="text_append" inline="false">
  251. <field name="VAR">log</field>
  252. <value name="TEXT">
  253. <block type="variables_get">
  254. <field name="VAR">x</field>
  255. </block>
  256. </value>
  257. </block>
  258. </next>
  259. </block>
  260. </statement>
  261. <next>
  262. <block type="unittest_assertequals" inline="false">
  263. <value name="MESSAGE">
  264. <block type="text">
  265. <field name="TEXT">count continue</field>
  266. </block>
  267. </value>
  268. <value name="ACTUAL">
  269. <block type="variables_get">
  270. <field name="VAR">log</field>
  271. </block>
  272. </value>
  273. <value name="EXPECTED">
  274. <block type="text">
  275. <field name="TEXT">1234678</field>
  276. </block>
  277. </value>
  278. <next>
  279. <block type="variables_set" inline="false">
  280. <field name="VAR">log</field>
  281. <value name="VALUE">
  282. <block type="text">
  283. <field name="TEXT"></field>
  284. </block>
  285. </value>
  286. <next>
  287. <block type="controls_forEach" inline="false">
  288. <field name="VAR">x</field>
  289. <value name="LIST">
  290. <block type="lists_create_with" inline="false">
  291. <mutation items="4"></mutation>
  292. <value name="ADD0">
  293. <block type="text">
  294. <field name="TEXT">a</field>
  295. </block>
  296. </value>
  297. <value name="ADD1">
  298. <block type="text">
  299. <field name="TEXT">b</field>
  300. </block>
  301. </value>
  302. <value name="ADD2">
  303. <block type="text">
  304. <field name="TEXT">c</field>
  305. </block>
  306. </value>
  307. <value name="ADD3">
  308. <block type="text">
  309. <field name="TEXT">d</field>
  310. </block>
  311. </value>
  312. </block>
  313. </value>
  314. <statement name="DO">
  315. <block type="controls_if" inline="false">
  316. <value name="IF0">
  317. <block type="logic_compare">
  318. <field name="OP">EQ</field>
  319. <value name="A">
  320. <block type="variables_get">
  321. <field name="VAR">x</field>
  322. </block>
  323. </value>
  324. <value name="B">
  325. <block type="text">
  326. <field name="TEXT">c</field>
  327. </block>
  328. </value>
  329. </block>
  330. </value>
  331. <statement name="DO0">
  332. <block type="controls_flow_statements">
  333. <field name="FLOW">CONTINUE</field>
  334. </block>
  335. </statement>
  336. <next>
  337. <block type="text_append" inline="false">
  338. <field name="VAR">log</field>
  339. <value name="TEXT">
  340. <block type="variables_get">
  341. <field name="VAR">x</field>
  342. </block>
  343. </value>
  344. </block>
  345. </next>
  346. </block>
  347. </statement>
  348. <next>
  349. <block type="unittest_assertequals" inline="false">
  350. <value name="MESSAGE">
  351. <block type="text">
  352. <field name="TEXT">for continue</field>
  353. </block>
  354. </value>
  355. <value name="ACTUAL">
  356. <block type="variables_get">
  357. <field name="VAR">log</field>
  358. </block>
  359. </value>
  360. <value name="EXPECTED">
  361. <block type="text">
  362. <field name="TEXT">abd</field>
  363. </block>
  364. </value>
  365. </block>
  366. </next>
  367. </block>
  368. </next>
  369. </block>
  370. </next>
  371. </block>
  372. </next>
  373. </block>
  374. </next>
  375. </block>
  376. </next>
  377. </block>
  378. </next>
  379. </block>
  380. </next>
  381. </block>
  382. </next>
  383. </block>
  384. </next>
  385. </block>
  386. </next>
  387. </block>
  388. </next>
  389. </block>
  390. </next>
  391. </block>
  392. </statement>
  393. </block>
  394. <block type="procedures_defnoreturn" x="600" y="300">
  395. <field name="NAME">test break</field>
  396. <statement name="STACK">
  397. <block type="variables_set" inline="false">
  398. <field name="VAR">count</field>
  399. <value name="VALUE">
  400. <block type="math_number">
  401. <field name="NUM">1</field>
  402. </block>
  403. </value>
  404. <next>
  405. <block type="controls_whileUntil" inline="false">
  406. <field name="MODE">WHILE</field>
  407. <value name="BOOL">
  408. <block type="logic_compare">
  409. <field name="OP">NEQ</field>
  410. <value name="A">
  411. <block type="variables_get">
  412. <field name="VAR">count</field>
  413. </block>
  414. </value>
  415. <value name="B">
  416. <block type="math_number">
  417. <field name="NUM">10</field>
  418. </block>
  419. </value>
  420. </block>
  421. </value>
  422. <statement name="DO">
  423. <block type="controls_if" inline="false">
  424. <value name="IF0">
  425. <block type="logic_compare">
  426. <field name="OP">EQ</field>
  427. <value name="A">
  428. <block type="variables_get">
  429. <field name="VAR">count</field>
  430. </block>
  431. </value>
  432. <value name="B">
  433. <block type="math_number">
  434. <field name="NUM">5</field>
  435. </block>
  436. </value>
  437. </block>
  438. </value>
  439. <statement name="DO0">
  440. <block type="controls_flow_statements">
  441. <field name="FLOW">BREAK</field>
  442. </block>
  443. </statement>
  444. <next>
  445. <block type="math_change" inline="false">
  446. <field name="VAR">count</field>
  447. <value name="DELTA">
  448. <block type="math_number">
  449. <field name="NUM">1</field>
  450. </block>
  451. </value>
  452. </block>
  453. </next>
  454. </block>
  455. </statement>
  456. <next>
  457. <block type="unittest_assertequals" inline="false">
  458. <value name="MESSAGE">
  459. <block type="text">
  460. <field name="TEXT">while break</field>
  461. </block>
  462. </value>
  463. <value name="ACTUAL">
  464. <block type="variables_get">
  465. <field name="VAR">count</field>
  466. </block>
  467. </value>
  468. <value name="EXPECTED">
  469. <block type="math_number">
  470. <field name="NUM">5</field>
  471. </block>
  472. </value>
  473. <next>
  474. <block type="variables_set" inline="false">
  475. <field name="VAR">count</field>
  476. <value name="VALUE">
  477. <block type="math_number">
  478. <field name="NUM">1</field>
  479. </block>
  480. </value>
  481. <next>
  482. <block type="controls_whileUntil" inline="false">
  483. <field name="MODE">UNTIL</field>
  484. <value name="BOOL">
  485. <block type="logic_compare">
  486. <field name="OP">EQ</field>
  487. <value name="A">
  488. <block type="variables_get">
  489. <field name="VAR">count</field>
  490. </block>
  491. </value>
  492. <value name="B">
  493. <block type="math_number">
  494. <field name="NUM">10</field>
  495. </block>
  496. </value>
  497. </block>
  498. </value>
  499. <statement name="DO">
  500. <block type="controls_if" inline="false">
  501. <value name="IF0">
  502. <block type="logic_compare">
  503. <field name="OP">EQ</field>
  504. <value name="A">
  505. <block type="variables_get">
  506. <field name="VAR">count</field>
  507. </block>
  508. </value>
  509. <value name="B">
  510. <block type="math_number">
  511. <field name="NUM">5</field>
  512. </block>
  513. </value>
  514. </block>
  515. </value>
  516. <statement name="DO0">
  517. <block type="controls_flow_statements">
  518. <field name="FLOW">BREAK</field>
  519. </block>
  520. </statement>
  521. <next>
  522. <block type="math_change" inline="false">
  523. <field name="VAR">count</field>
  524. <value name="DELTA">
  525. <block type="math_number">
  526. <field name="NUM">1</field>
  527. </block>
  528. </value>
  529. </block>
  530. </next>
  531. </block>
  532. </statement>
  533. <next>
  534. <block type="unittest_assertequals" inline="false">
  535. <value name="MESSAGE">
  536. <block type="text">
  537. <field name="TEXT">until break</field>
  538. </block>
  539. </value>
  540. <value name="ACTUAL">
  541. <block type="variables_get">
  542. <field name="VAR">count</field>
  543. </block>
  544. </value>
  545. <value name="EXPECTED">
  546. <block type="math_number">
  547. <field name="NUM">5</field>
  548. </block>
  549. </value>
  550. <next>
  551. <block type="variables_set" inline="false">
  552. <field name="VAR">log</field>
  553. <value name="VALUE">
  554. <block type="text">
  555. <field name="TEXT"></field>
  556. </block>
  557. </value>
  558. <next>
  559. <block type="controls_for">
  560. <field name="VAR">x</field>
  561. <value name="FROM">
  562. <block type="math_number">
  563. <field name="NUM">1</field>
  564. </block>
  565. </value>
  566. <value name="TO">
  567. <block type="math_number">
  568. <field name="NUM">8</field>
  569. </block>
  570. </value>
  571. <statement name="DO">
  572. <block type="controls_if" inline="false">
  573. <value name="IF0">
  574. <block type="logic_compare">
  575. <field name="OP">EQ</field>
  576. <value name="A">
  577. <block type="variables_get">
  578. <field name="VAR">x</field>
  579. </block>
  580. </value>
  581. <value name="B">
  582. <block type="math_number">
  583. <field name="NUM">5</field>
  584. </block>
  585. </value>
  586. </block>
  587. </value>
  588. <statement name="DO0">
  589. <block type="controls_flow_statements">
  590. <field name="FLOW">BREAK</field>
  591. </block>
  592. </statement>
  593. <next>
  594. <block type="text_append" inline="false">
  595. <field name="VAR">log</field>
  596. <value name="TEXT">
  597. <block type="variables_get">
  598. <field name="VAR">x</field>
  599. </block>
  600. </value>
  601. </block>
  602. </next>
  603. </block>
  604. </statement>
  605. <next>
  606. <block type="unittest_assertequals" inline="false">
  607. <value name="MESSAGE">
  608. <block type="text">
  609. <field name="TEXT">count break</field>
  610. </block>
  611. </value>
  612. <value name="ACTUAL">
  613. <block type="variables_get">
  614. <field name="VAR">log</field>
  615. </block>
  616. </value>
  617. <value name="EXPECTED">
  618. <block type="text">
  619. <field name="TEXT">1234</field>
  620. </block>
  621. </value>
  622. <next>
  623. <block type="variables_set" inline="false">
  624. <field name="VAR">log</field>
  625. <value name="VALUE">
  626. <block type="text">
  627. <field name="TEXT"></field>
  628. </block>
  629. </value>
  630. <next>
  631. <block type="controls_forEach" inline="false">
  632. <field name="VAR">x</field>
  633. <value name="LIST">
  634. <block type="lists_create_with" inline="false">
  635. <mutation items="4"></mutation>
  636. <value name="ADD0">
  637. <block type="text">
  638. <field name="TEXT">a</field>
  639. </block>
  640. </value>
  641. <value name="ADD1">
  642. <block type="text">
  643. <field name="TEXT">b</field>
  644. </block>
  645. </value>
  646. <value name="ADD2">
  647. <block type="text">
  648. <field name="TEXT">c</field>
  649. </block>
  650. </value>
  651. <value name="ADD3">
  652. <block type="text">
  653. <field name="TEXT">d</field>
  654. </block>
  655. </value>
  656. </block>
  657. </value>
  658. <statement name="DO">
  659. <block type="controls_if" inline="false">
  660. <value name="IF0">
  661. <block type="logic_compare">
  662. <field name="OP">EQ</field>
  663. <value name="A">
  664. <block type="variables_get">
  665. <field name="VAR">x</field>
  666. </block>
  667. </value>
  668. <value name="B">
  669. <block type="text">
  670. <field name="TEXT">c</field>
  671. </block>
  672. </value>
  673. </block>
  674. </value>
  675. <statement name="DO0">
  676. <block type="controls_flow_statements">
  677. <field name="FLOW">BREAK</field>
  678. </block>
  679. </statement>
  680. <next>
  681. <block type="text_append" inline="false">
  682. <field name="VAR">log</field>
  683. <value name="TEXT">
  684. <block type="variables_get">
  685. <field name="VAR">x</field>
  686. </block>
  687. </value>
  688. </block>
  689. </next>
  690. </block>
  691. </statement>
  692. <next>
  693. <block type="unittest_assertequals" inline="false">
  694. <value name="MESSAGE">
  695. <block type="text">
  696. <field name="TEXT">for break</field>
  697. </block>
  698. </value>
  699. <value name="ACTUAL">
  700. <block type="variables_get">
  701. <field name="VAR">log</field>
  702. </block>
  703. </value>
  704. <value name="EXPECTED">
  705. <block type="text">
  706. <field name="TEXT">ab</field>
  707. </block>
  708. </value>
  709. </block>
  710. </next>
  711. </block>
  712. </next>
  713. </block>
  714. </next>
  715. </block>
  716. </next>
  717. </block>
  718. </next>
  719. </block>
  720. </next>
  721. </block>
  722. </next>
  723. </block>
  724. </next>
  725. </block>
  726. </next>
  727. </block>
  728. </next>
  729. </block>
  730. </next>
  731. </block>
  732. </statement>
  733. </block>
  734. </xml>