math.xml 85 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884
  1. <xml xmlns="http://www.w3.org/1999/xhtml">
  2. <block type="unittest_main" x="13" y="13">
  3. <statement name="DO">
  4. <block type="procedures_callnoreturn">
  5. <mutation name="test arithmetic"></mutation>
  6. <next>
  7. <block type="procedures_callnoreturn">
  8. <mutation name="test single"></mutation>
  9. <next>
  10. <block type="procedures_callnoreturn">
  11. <mutation name="test trig"></mutation>
  12. <next>
  13. <block type="procedures_callnoreturn">
  14. <mutation name="test constant"></mutation>
  15. <next>
  16. <block type="procedures_callnoreturn">
  17. <mutation name="test change"></mutation>
  18. <next>
  19. <block type="procedures_callnoreturn">
  20. <mutation name="test number properties"></mutation>
  21. <next>
  22. <block type="procedures_callnoreturn">
  23. <mutation name="test round"></mutation>
  24. <next>
  25. <block type="procedures_callnoreturn">
  26. <mutation name="test operations on list"></mutation>
  27. <next>
  28. <block type="procedures_callnoreturn">
  29. <mutation name="test constraint"></mutation>
  30. <next>
  31. <block type="procedures_callnoreturn">
  32. <mutation name="test mod"></mutation>
  33. <next>
  34. <block type="procedures_callnoreturn">
  35. <mutation name="test random integer"></mutation>
  36. <next>
  37. <block type="procedures_callnoreturn">
  38. <mutation name="test random fraction"></mutation>
  39. </block>
  40. </next>
  41. </block>
  42. </next>
  43. </block>
  44. </next>
  45. </block>
  46. </next>
  47. </block>
  48. </next>
  49. </block>
  50. </next>
  51. </block>
  52. </next>
  53. </block>
  54. </next>
  55. </block>
  56. </next>
  57. </block>
  58. </next>
  59. </block>
  60. </next>
  61. </block>
  62. </statement>
  63. </block>
  64. <block type="procedures_defnoreturn" x="13" y="388">
  65. <field name="NAME">test single</field>
  66. <comment pinned="false" h="80" w="160">Tests the "single" block.</comment>
  67. <statement name="STACK">
  68. <block type="unittest_assertequals" inline="false">
  69. <value name="MESSAGE">
  70. <block type="text">
  71. <field name="TEXT">sqrt</field>
  72. </block>
  73. </value>
  74. <value name="ACTUAL">
  75. <block type="math_single" inline="false">
  76. <field name="OP">ROOT</field>
  77. <value name="NUM">
  78. <block type="math_number">
  79. <field name="NUM">25</field>
  80. </block>
  81. </value>
  82. </block>
  83. </value>
  84. <value name="EXPECTED">
  85. <block type="math_number">
  86. <field name="NUM">5</field>
  87. </block>
  88. </value>
  89. <next>
  90. <block type="unittest_assertequals" inline="false">
  91. <value name="MESSAGE">
  92. <block type="text">
  93. <field name="TEXT">abs</field>
  94. </block>
  95. </value>
  96. <value name="ACTUAL">
  97. <block type="math_single" inline="false">
  98. <field name="OP">ABS</field>
  99. <value name="NUM">
  100. <block type="math_number">
  101. <field name="NUM">-25</field>
  102. </block>
  103. </value>
  104. </block>
  105. </value>
  106. <value name="EXPECTED">
  107. <block type="math_number">
  108. <field name="NUM">25</field>
  109. </block>
  110. </value>
  111. <next>
  112. <block type="unittest_assertequals" inline="false">
  113. <value name="MESSAGE">
  114. <block type="text">
  115. <field name="TEXT">negate</field>
  116. </block>
  117. </value>
  118. <value name="ACTUAL">
  119. <block type="math_single" inline="false">
  120. <field name="OP">NEG</field>
  121. <value name="NUM">
  122. <block type="math_number">
  123. <field name="NUM">-25</field>
  124. </block>
  125. </value>
  126. </block>
  127. </value>
  128. <value name="EXPECTED">
  129. <block type="math_number">
  130. <field name="NUM">25</field>
  131. </block>
  132. </value>
  133. <next>
  134. <block type="unittest_assertequals" inline="false">
  135. <value name="MESSAGE">
  136. <block type="text">
  137. <field name="TEXT">ln</field>
  138. </block>
  139. </value>
  140. <value name="ACTUAL">
  141. <block type="math_single" inline="false">
  142. <field name="OP">LN</field>
  143. <value name="NUM">
  144. <block type="math_number">
  145. <field name="NUM">1</field>
  146. </block>
  147. </value>
  148. </block>
  149. </value>
  150. <value name="EXPECTED">
  151. <block type="math_number">
  152. <field name="NUM">0</field>
  153. </block>
  154. </value>
  155. <next>
  156. <block type="unittest_assertequals" inline="false">
  157. <value name="MESSAGE">
  158. <block type="text">
  159. <field name="TEXT">log10</field>
  160. </block>
  161. </value>
  162. <value name="ACTUAL">
  163. <block type="math_single" inline="false">
  164. <field name="OP">LOG10</field>
  165. <value name="NUM">
  166. <block type="math_number">
  167. <field name="NUM">100</field>
  168. </block>
  169. </value>
  170. </block>
  171. </value>
  172. <value name="EXPECTED">
  173. <block type="math_number">
  174. <field name="NUM">2</field>
  175. </block>
  176. </value>
  177. <next>
  178. <block type="unittest_assertequals" inline="false">
  179. <value name="MESSAGE">
  180. <block type="text">
  181. <field name="TEXT">exp</field>
  182. </block>
  183. </value>
  184. <value name="ACTUAL">
  185. <block type="math_single" inline="false">
  186. <field name="OP">EXP</field>
  187. <value name="NUM">
  188. <block type="math_number">
  189. <field name="NUM">2</field>
  190. </block>
  191. </value>
  192. </block>
  193. </value>
  194. <value name="EXPECTED">
  195. <block type="math_number">
  196. <field name="NUM">7.38905609893065</field>
  197. </block>
  198. </value>
  199. <next>
  200. <block type="unittest_assertequals" inline="false">
  201. <value name="MESSAGE">
  202. <block type="text">
  203. <field name="TEXT">power10</field>
  204. </block>
  205. </value>
  206. <value name="ACTUAL">
  207. <block type="math_single" inline="false">
  208. <field name="OP">POW10</field>
  209. <value name="NUM">
  210. <block type="math_number">
  211. <field name="NUM">2</field>
  212. </block>
  213. </value>
  214. </block>
  215. </value>
  216. <value name="EXPECTED">
  217. <block type="math_number">
  218. <field name="NUM">100</field>
  219. </block>
  220. </value>
  221. </block>
  222. </next>
  223. </block>
  224. </next>
  225. </block>
  226. </next>
  227. </block>
  228. </next>
  229. </block>
  230. </next>
  231. </block>
  232. </next>
  233. </block>
  234. </statement>
  235. </block>
  236. <block type="procedures_defnoreturn" x="13" y="1013">
  237. <field name="NAME">test arithmetic</field>
  238. <comment pinned="false" h="80" w="272">Tests the "arithmetic" block for all operations and checks parenthesis are properly generated for different orders.</comment>
  239. <statement name="STACK">
  240. <block type="unittest_assertequals" inline="false">
  241. <value name="MESSAGE">
  242. <block type="text">
  243. <field name="TEXT">add</field>
  244. </block>
  245. </value>
  246. <value name="ACTUAL">
  247. <block type="math_arithmetic">
  248. <field name="OP">ADD</field>
  249. <value name="A">
  250. <block type="math_number">
  251. <field name="NUM">1</field>
  252. </block>
  253. </value>
  254. <value name="B">
  255. <block type="math_number">
  256. <field name="NUM">2</field>
  257. </block>
  258. </value>
  259. </block>
  260. </value>
  261. <value name="EXPECTED">
  262. <block type="math_number">
  263. <field name="NUM">3</field>
  264. </block>
  265. </value>
  266. <next>
  267. <block type="unittest_assertequals" inline="false">
  268. <value name="MESSAGE">
  269. <block type="text">
  270. <field name="TEXT">subtract</field>
  271. </block>
  272. </value>
  273. <value name="ACTUAL">
  274. <block type="math_arithmetic">
  275. <field name="OP">MINUS</field>
  276. <value name="A">
  277. <block type="math_number">
  278. <field name="NUM">1</field>
  279. </block>
  280. </value>
  281. <value name="B">
  282. <block type="math_number">
  283. <field name="NUM">2</field>
  284. </block>
  285. </value>
  286. </block>
  287. </value>
  288. <value name="EXPECTED">
  289. <block type="math_number">
  290. <field name="NUM">-1</field>
  291. </block>
  292. </value>
  293. <next>
  294. <block type="unittest_assertequals" inline="false">
  295. <value name="MESSAGE">
  296. <block type="text">
  297. <field name="TEXT">subtract order with add</field>
  298. </block>
  299. </value>
  300. <value name="ACTUAL">
  301. <block type="math_arithmetic">
  302. <field name="OP">MINUS</field>
  303. <value name="A">
  304. <block type="math_number">
  305. <field name="NUM">1</field>
  306. </block>
  307. </value>
  308. <value name="B">
  309. <block type="math_arithmetic">
  310. <field name="OP">ADD</field>
  311. <value name="A">
  312. <block type="math_number">
  313. <field name="NUM">0</field>
  314. </block>
  315. </value>
  316. <value name="B">
  317. <block type="math_number">
  318. <field name="NUM">2</field>
  319. </block>
  320. </value>
  321. </block>
  322. </value>
  323. </block>
  324. </value>
  325. <value name="EXPECTED">
  326. <block type="math_number">
  327. <field name="NUM">-1</field>
  328. </block>
  329. </value>
  330. <next>
  331. <block type="unittest_assertequals" inline="false">
  332. <value name="MESSAGE">
  333. <block type="text">
  334. <field name="TEXT">subtract order with subtract</field>
  335. </block>
  336. </value>
  337. <value name="ACTUAL">
  338. <block type="math_arithmetic">
  339. <field name="OP">MINUS</field>
  340. <value name="A">
  341. <block type="math_number">
  342. <field name="NUM">1</field>
  343. </block>
  344. </value>
  345. <value name="B">
  346. <block type="math_arithmetic">
  347. <field name="OP">MINUS</field>
  348. <value name="A">
  349. <block type="math_number">
  350. <field name="NUM">0</field>
  351. </block>
  352. </value>
  353. <value name="B">
  354. <block type="math_number">
  355. <field name="NUM">2</field>
  356. </block>
  357. </value>
  358. </block>
  359. </value>
  360. </block>
  361. </value>
  362. <value name="EXPECTED">
  363. <block type="math_number">
  364. <field name="NUM">3</field>
  365. </block>
  366. </value>
  367. <next>
  368. <block type="unittest_assertequals" inline="false">
  369. <value name="MESSAGE">
  370. <block type="text">
  371. <field name="TEXT">multiply</field>
  372. </block>
  373. </value>
  374. <value name="ACTUAL">
  375. <block type="math_arithmetic">
  376. <field name="OP">MULTIPLY</field>
  377. <value name="A">
  378. <block type="math_number">
  379. <field name="NUM">4</field>
  380. </block>
  381. </value>
  382. <value name="B">
  383. <block type="math_number">
  384. <field name="NUM">2.5</field>
  385. </block>
  386. </value>
  387. </block>
  388. </value>
  389. <value name="EXPECTED">
  390. <block type="math_number">
  391. <field name="NUM">10</field>
  392. </block>
  393. </value>
  394. <next>
  395. <block type="unittest_assertequals" inline="false">
  396. <value name="MESSAGE">
  397. <block type="text">
  398. <field name="TEXT">multiply order</field>
  399. </block>
  400. </value>
  401. <value name="ACTUAL">
  402. <block type="math_arithmetic">
  403. <field name="OP">MULTIPLY</field>
  404. <value name="A">
  405. <block type="math_number">
  406. <field name="NUM">4</field>
  407. </block>
  408. </value>
  409. <value name="B">
  410. <block type="math_arithmetic">
  411. <field name="OP">ADD</field>
  412. <value name="A">
  413. <block type="math_number">
  414. <field name="NUM">0</field>
  415. </block>
  416. </value>
  417. <value name="B">
  418. <block type="math_number">
  419. <field name="NUM">2.5</field>
  420. </block>
  421. </value>
  422. </block>
  423. </value>
  424. </block>
  425. </value>
  426. <value name="EXPECTED">
  427. <block type="math_number">
  428. <field name="NUM">10</field>
  429. </block>
  430. </value>
  431. <next>
  432. <block type="unittest_assertequals" inline="false">
  433. <value name="MESSAGE">
  434. <block type="text">
  435. <field name="TEXT">divide</field>
  436. </block>
  437. </value>
  438. <value name="ACTUAL">
  439. <block type="math_arithmetic">
  440. <field name="OP">DIVIDE</field>
  441. <value name="A">
  442. <block type="math_number">
  443. <field name="NUM">8.2</field>
  444. </block>
  445. </value>
  446. <value name="B">
  447. <block type="math_number">
  448. <field name="NUM">-5</field>
  449. </block>
  450. </value>
  451. </block>
  452. </value>
  453. <value name="EXPECTED">
  454. <block type="math_number">
  455. <field name="NUM">-1.64</field>
  456. </block>
  457. </value>
  458. <next>
  459. <block type="unittest_assertequals" inline="false">
  460. <value name="MESSAGE">
  461. <block type="text">
  462. <field name="TEXT">divide order</field>
  463. </block>
  464. </value>
  465. <value name="ACTUAL">
  466. <block type="math_arithmetic">
  467. <field name="OP">DIVIDE</field>
  468. <value name="A">
  469. <block type="math_number">
  470. <field name="NUM">8.2</field>
  471. </block>
  472. </value>
  473. <value name="B">
  474. <block type="math_arithmetic">
  475. <field name="OP">ADD</field>
  476. <value name="A">
  477. <block type="math_number">
  478. <field name="NUM">0</field>
  479. </block>
  480. </value>
  481. <value name="B">
  482. <block type="math_number">
  483. <field name="NUM">-5</field>
  484. </block>
  485. </value>
  486. </block>
  487. </value>
  488. </block>
  489. </value>
  490. <value name="EXPECTED">
  491. <block type="math_number">
  492. <field name="NUM">-1.64</field>
  493. </block>
  494. </value>
  495. <next>
  496. <block type="unittest_assertequals" inline="false">
  497. <value name="MESSAGE">
  498. <block type="text">
  499. <field name="TEXT">power</field>
  500. </block>
  501. </value>
  502. <value name="ACTUAL">
  503. <block type="math_arithmetic">
  504. <field name="OP">POWER</field>
  505. <value name="A">
  506. <block type="math_number">
  507. <field name="NUM">10</field>
  508. </block>
  509. </value>
  510. <value name="B">
  511. <block type="math_number">
  512. <field name="NUM">4</field>
  513. </block>
  514. </value>
  515. </block>
  516. </value>
  517. <value name="EXPECTED">
  518. <block type="math_number">
  519. <field name="NUM">10000</field>
  520. </block>
  521. </value>
  522. <next>
  523. <block type="unittest_assertequals" inline="false">
  524. <value name="MESSAGE">
  525. <block type="text">
  526. <field name="TEXT">power order</field>
  527. </block>
  528. </value>
  529. <value name="ACTUAL">
  530. <block type="math_arithmetic">
  531. <field name="OP">POWER</field>
  532. <value name="A">
  533. <block type="math_number">
  534. <field name="NUM">10</field>
  535. </block>
  536. </value>
  537. <value name="B">
  538. <block type="math_arithmetic">
  539. <field name="OP">ADD</field>
  540. <value name="A">
  541. <block type="math_number">
  542. <field name="NUM">0</field>
  543. </block>
  544. </value>
  545. <value name="B">
  546. <block type="math_number">
  547. <field name="NUM">4</field>
  548. </block>
  549. </value>
  550. </block>
  551. </value>
  552. </block>
  553. </value>
  554. <value name="EXPECTED">
  555. <block type="math_number">
  556. <field name="NUM">10000</field>
  557. </block>
  558. </value>
  559. </block>
  560. </next>
  561. </block>
  562. </next>
  563. </block>
  564. </next>
  565. </block>
  566. </next>
  567. </block>
  568. </next>
  569. </block>
  570. </next>
  571. </block>
  572. </next>
  573. </block>
  574. </next>
  575. </block>
  576. </next>
  577. </block>
  578. </statement>
  579. </block>
  580. <block type="procedures_defnoreturn" x="13" y="2013">
  581. <field name="NAME">test trig</field>
  582. <comment pinned="false" h="80" w="160">Tests the "trig" block.</comment>
  583. <statement name="STACK">
  584. <block type="unittest_assertequals" inline="false">
  585. <value name="MESSAGE">
  586. <block type="text">
  587. <field name="TEXT">sin</field>
  588. </block>
  589. </value>
  590. <value name="ACTUAL">
  591. <block type="math_trig" inline="false">
  592. <field name="OP">SIN</field>
  593. <value name="NUM">
  594. <block type="math_number">
  595. <field name="NUM">90</field>
  596. </block>
  597. </value>
  598. </block>
  599. </value>
  600. <value name="EXPECTED">
  601. <block type="math_number">
  602. <field name="NUM">1</field>
  603. </block>
  604. </value>
  605. <next>
  606. <block type="unittest_assertequals" inline="false">
  607. <value name="MESSAGE">
  608. <block type="text">
  609. <field name="TEXT">cos</field>
  610. </block>
  611. </value>
  612. <value name="ACTUAL">
  613. <block type="math_trig" inline="false">
  614. <field name="OP">COS</field>
  615. <value name="NUM">
  616. <block type="math_number">
  617. <field name="NUM">180</field>
  618. </block>
  619. </value>
  620. </block>
  621. </value>
  622. <value name="EXPECTED">
  623. <block type="math_number">
  624. <field name="NUM">-1</field>
  625. </block>
  626. </value>
  627. <next>
  628. <block type="unittest_assertequals" inline="false">
  629. <value name="MESSAGE">
  630. <block type="text">
  631. <field name="TEXT">tan</field>
  632. </block>
  633. </value>
  634. <value name="ACTUAL">
  635. <block type="math_trig" inline="false">
  636. <field name="OP">TAN</field>
  637. <value name="NUM">
  638. <block type="math_number">
  639. <field name="NUM">0</field>
  640. </block>
  641. </value>
  642. </block>
  643. </value>
  644. <value name="EXPECTED">
  645. <block type="math_number">
  646. <field name="NUM">0</field>
  647. </block>
  648. </value>
  649. <next>
  650. <block type="unittest_assertequals" inline="false">
  651. <value name="MESSAGE">
  652. <block type="text">
  653. <field name="TEXT">asin</field>
  654. </block>
  655. </value>
  656. <value name="ACTUAL">
  657. <block type="math_trig" inline="false">
  658. <field name="OP">ASIN</field>
  659. <value name="NUM">
  660. <block type="math_number">
  661. <field name="NUM">-1</field>
  662. </block>
  663. </value>
  664. </block>
  665. </value>
  666. <value name="EXPECTED">
  667. <block type="math_number">
  668. <field name="NUM">-90</field>
  669. </block>
  670. </value>
  671. <next>
  672. <block type="unittest_assertequals" inline="false">
  673. <value name="MESSAGE">
  674. <block type="text">
  675. <field name="TEXT">acos</field>
  676. </block>
  677. </value>
  678. <value name="ACTUAL">
  679. <block type="math_trig" inline="false">
  680. <field name="OP">ACOS</field>
  681. <value name="NUM">
  682. <block type="math_number">
  683. <field name="NUM">1</field>
  684. </block>
  685. </value>
  686. </block>
  687. </value>
  688. <value name="EXPECTED">
  689. <block type="math_number">
  690. <field name="NUM">0</field>
  691. </block>
  692. </value>
  693. <next>
  694. <block type="unittest_assertequals" inline="false">
  695. <value name="MESSAGE">
  696. <block type="text">
  697. <field name="TEXT">atan</field>
  698. </block>
  699. </value>
  700. <value name="ACTUAL">
  701. <block type="math_trig" inline="false">
  702. <field name="OP">ATAN</field>
  703. <value name="NUM">
  704. <block type="math_number">
  705. <field name="NUM">1</field>
  706. </block>
  707. </value>
  708. </block>
  709. </value>
  710. <value name="EXPECTED">
  711. <block type="math_number">
  712. <field name="NUM">45</field>
  713. </block>
  714. </value>
  715. </block>
  716. </next>
  717. </block>
  718. </next>
  719. </block>
  720. </next>
  721. </block>
  722. </next>
  723. </block>
  724. </next>
  725. </block>
  726. </statement>
  727. </block>
  728. <block type="procedures_defnoreturn" x="13" y="2538">
  729. <field name="NAME">test constant</field>
  730. <comment pinned="false" h="80" w="160">Tests the "constant" blocks.</comment>
  731. <statement name="STACK">
  732. <block type="unittest_assertequals" inline="false">
  733. <value name="MESSAGE">
  734. <block type="text">
  735. <field name="TEXT">const pi</field>
  736. </block>
  737. </value>
  738. <value name="ACTUAL">
  739. <block type="math_round" inline="false">
  740. <field name="OP">ROUNDDOWN</field>
  741. <value name="NUM">
  742. <block type="math_arithmetic">
  743. <field name="OP">MULTIPLY</field>
  744. <value name="A">
  745. <block type="math_constant">
  746. <field name="CONSTANT">PI</field>
  747. </block>
  748. </value>
  749. <value name="B">
  750. <block type="math_number">
  751. <field name="NUM">1000</field>
  752. </block>
  753. </value>
  754. </block>
  755. </value>
  756. </block>
  757. </value>
  758. <value name="EXPECTED">
  759. <block type="math_number">
  760. <field name="NUM">3141</field>
  761. </block>
  762. </value>
  763. <next>
  764. <block type="unittest_assertequals" inline="false">
  765. <value name="MESSAGE">
  766. <block type="text">
  767. <field name="TEXT">const e</field>
  768. </block>
  769. </value>
  770. <value name="ACTUAL">
  771. <block type="math_round" inline="false">
  772. <field name="OP">ROUNDDOWN</field>
  773. <value name="NUM">
  774. <block type="math_arithmetic">
  775. <field name="OP">MULTIPLY</field>
  776. <value name="A">
  777. <block type="math_constant">
  778. <field name="CONSTANT">E</field>
  779. </block>
  780. </value>
  781. <value name="B">
  782. <block type="math_number">
  783. <field name="NUM">1000</field>
  784. </block>
  785. </value>
  786. </block>
  787. </value>
  788. </block>
  789. </value>
  790. <value name="EXPECTED">
  791. <block type="math_number">
  792. <field name="NUM">2718</field>
  793. </block>
  794. </value>
  795. <next>
  796. <block type="unittest_assertequals" inline="false">
  797. <value name="MESSAGE">
  798. <block type="text">
  799. <field name="TEXT">const golden</field>
  800. </block>
  801. </value>
  802. <value name="ACTUAL">
  803. <block type="math_round" inline="false">
  804. <field name="OP">ROUNDDOWN</field>
  805. <value name="NUM">
  806. <block type="math_arithmetic">
  807. <field name="OP">MULTIPLY</field>
  808. <value name="A">
  809. <block type="math_constant">
  810. <field name="CONSTANT">GOLDEN_RATIO</field>
  811. </block>
  812. </value>
  813. <value name="B">
  814. <block type="math_number">
  815. <field name="NUM">1000</field>
  816. </block>
  817. </value>
  818. </block>
  819. </value>
  820. </block>
  821. </value>
  822. <value name="EXPECTED">
  823. <block type="math_number">
  824. <field name="NUM">1618</field>
  825. </block>
  826. </value>
  827. <next>
  828. <block type="unittest_assertequals" inline="false">
  829. <value name="MESSAGE">
  830. <block type="text">
  831. <field name="TEXT">const sqrt 2</field>
  832. </block>
  833. </value>
  834. <value name="ACTUAL">
  835. <block type="math_round" inline="false">
  836. <field name="OP">ROUNDDOWN</field>
  837. <value name="NUM">
  838. <block type="math_arithmetic">
  839. <field name="OP">MULTIPLY</field>
  840. <value name="A">
  841. <block type="math_constant">
  842. <field name="CONSTANT">SQRT2</field>
  843. </block>
  844. </value>
  845. <value name="B">
  846. <block type="math_number">
  847. <field name="NUM">1000</field>
  848. </block>
  849. </value>
  850. </block>
  851. </value>
  852. </block>
  853. </value>
  854. <value name="EXPECTED">
  855. <block type="math_number">
  856. <field name="NUM">1414</field>
  857. </block>
  858. </value>
  859. <next>
  860. <block type="unittest_assertequals" inline="false">
  861. <value name="MESSAGE">
  862. <block type="text">
  863. <field name="TEXT">const sqrt 0.5</field>
  864. </block>
  865. </value>
  866. <value name="ACTUAL">
  867. <block type="math_round" inline="false">
  868. <field name="OP">ROUNDDOWN</field>
  869. <value name="NUM">
  870. <block type="math_arithmetic">
  871. <field name="OP">MULTIPLY</field>
  872. <value name="A">
  873. <block type="math_constant">
  874. <field name="CONSTANT">SQRT1_2</field>
  875. </block>
  876. </value>
  877. <value name="B">
  878. <block type="math_number">
  879. <field name="NUM">1000</field>
  880. </block>
  881. </value>
  882. </block>
  883. </value>
  884. </block>
  885. </value>
  886. <value name="EXPECTED">
  887. <block type="math_number">
  888. <field name="NUM">707</field>
  889. </block>
  890. </value>
  891. <next>
  892. <block type="unittest_assertvalue" inline="false">
  893. <field name="EXPECTED">TRUE</field>
  894. <value name="MESSAGE">
  895. <block type="text">
  896. <field name="TEXT">const infinity</field>
  897. </block>
  898. </value>
  899. <value name="ACTUAL">
  900. <block type="logic_compare">
  901. <field name="OP">LT</field>
  902. <value name="A">
  903. <block type="math_number">
  904. <field name="NUM">9999</field>
  905. </block>
  906. </value>
  907. <value name="B">
  908. <block type="math_constant">
  909. <field name="CONSTANT">INFINITY</field>
  910. </block>
  911. </value>
  912. </block>
  913. </value>
  914. </block>
  915. </next>
  916. </block>
  917. </next>
  918. </block>
  919. </next>
  920. </block>
  921. </next>
  922. </block>
  923. </next>
  924. </block>
  925. </statement>
  926. </block>
  927. <block type="procedures_defnoreturn" x="13" y="3113">
  928. <field name="NAME">test number properties</field>
  929. <comment pinned="false" h="80" w="160">Tests the "number property" blocks.</comment>
  930. <statement name="STACK">
  931. <block type="unittest_assertvalue" inline="false">
  932. <field name="EXPECTED">TRUE</field>
  933. <value name="MESSAGE">
  934. <block type="text">
  935. <field name="TEXT">even</field>
  936. </block>
  937. </value>
  938. <value name="ACTUAL">
  939. <block type="math_number_property">
  940. <mutation divisor_input="false"></mutation>
  941. <field name="PROPERTY">EVEN</field>
  942. <value name="NUMBER_TO_CHECK">
  943. <block type="math_number">
  944. <field name="NUM">42</field>
  945. </block>
  946. </value>
  947. </block>
  948. </value>
  949. <next>
  950. <block type="unittest_assertvalue" inline="false">
  951. <field name="EXPECTED">FALSE</field>
  952. <value name="MESSAGE">
  953. <block type="text">
  954. <field name="TEXT">odd</field>
  955. </block>
  956. </value>
  957. <value name="ACTUAL">
  958. <block type="math_number_property">
  959. <mutation divisor_input="false"></mutation>
  960. <field name="PROPERTY">ODD</field>
  961. <value name="NUMBER_TO_CHECK">
  962. <block type="math_number">
  963. <field name="NUM">42.1</field>
  964. </block>
  965. </value>
  966. </block>
  967. </value>
  968. <next>
  969. <block type="unittest_assertvalue" inline="false">
  970. <field name="EXPECTED">TRUE</field>
  971. <value name="MESSAGE">
  972. <block type="text">
  973. <field name="TEXT">prime 5</field>
  974. </block>
  975. </value>
  976. <value name="ACTUAL">
  977. <block type="math_number_property">
  978. <mutation divisor_input="false"></mutation>
  979. <field name="PROPERTY">PRIME</field>
  980. <value name="NUMBER_TO_CHECK">
  981. <block type="math_number">
  982. <field name="NUM">5</field>
  983. </block>
  984. </value>
  985. </block>
  986. </value>
  987. <next>
  988. <block type="unittest_assertvalue" inline="false">
  989. <field name="EXPECTED">FALSE</field>
  990. <value name="MESSAGE">
  991. <block type="text">
  992. <field name="TEXT">prime 25</field>
  993. </block>
  994. </value>
  995. <value name="ACTUAL">
  996. <block type="math_number_property">
  997. <mutation divisor_input="false"></mutation>
  998. <field name="PROPERTY">PRIME</field>
  999. <value name="NUMBER_TO_CHECK">
  1000. <block type="math_number">
  1001. <field name="NUM">25</field>
  1002. </block>
  1003. </value>
  1004. </block>
  1005. </value>
  1006. <next>
  1007. <block type="unittest_assertvalue" inline="false">
  1008. <field name="EXPECTED">FALSE</field>
  1009. <value name="MESSAGE">
  1010. <block type="text">
  1011. <field name="TEXT">prime negative</field>
  1012. </block>
  1013. </value>
  1014. <value name="ACTUAL">
  1015. <block type="math_number_property">
  1016. <mutation divisor_input="false"></mutation>
  1017. <field name="PROPERTY">PRIME</field>
  1018. <value name="NUMBER_TO_CHECK">
  1019. <block type="math_number">
  1020. <field name="NUM">-31.1</field>
  1021. </block>
  1022. </value>
  1023. </block>
  1024. </value>
  1025. <next>
  1026. <block type="unittest_assertvalue" inline="false">
  1027. <field name="EXPECTED">FALSE</field>
  1028. <value name="MESSAGE">
  1029. <block type="text">
  1030. <field name="TEXT">whole</field>
  1031. </block>
  1032. </value>
  1033. <value name="ACTUAL">
  1034. <block type="math_number_property">
  1035. <mutation divisor_input="false"></mutation>
  1036. <field name="PROPERTY">WHOLE</field>
  1037. <value name="NUMBER_TO_CHECK">
  1038. <block type="math_constant">
  1039. <field name="CONSTANT">PI</field>
  1040. </block>
  1041. </value>
  1042. </block>
  1043. </value>
  1044. <next>
  1045. <block type="unittest_assertvalue" inline="false">
  1046. <field name="EXPECTED">TRUE</field>
  1047. <value name="MESSAGE">
  1048. <block type="text">
  1049. <field name="TEXT">positive</field>
  1050. </block>
  1051. </value>
  1052. <value name="ACTUAL">
  1053. <block type="math_number_property">
  1054. <mutation divisor_input="false"></mutation>
  1055. <field name="PROPERTY">POSITIVE</field>
  1056. <value name="NUMBER_TO_CHECK">
  1057. <block type="math_constant">
  1058. <field name="CONSTANT">INFINITY</field>
  1059. </block>
  1060. </value>
  1061. </block>
  1062. </value>
  1063. <next>
  1064. <block type="unittest_assertvalue" inline="false">
  1065. <field name="EXPECTED">TRUE</field>
  1066. <value name="MESSAGE">
  1067. <block type="text">
  1068. <field name="TEXT">negative</field>
  1069. </block>
  1070. </value>
  1071. <value name="ACTUAL">
  1072. <block type="math_number_property">
  1073. <mutation divisor_input="false"></mutation>
  1074. <field name="PROPERTY">NEGATIVE</field>
  1075. <value name="NUMBER_TO_CHECK">
  1076. <block type="math_number">
  1077. <field name="NUM">-42</field>
  1078. </block>
  1079. </value>
  1080. </block>
  1081. </value>
  1082. <next>
  1083. <block type="unittest_assertvalue" inline="false">
  1084. <field name="EXPECTED">TRUE</field>
  1085. <value name="MESSAGE">
  1086. <block type="text">
  1087. <field name="TEXT">divisible</field>
  1088. </block>
  1089. </value>
  1090. <value name="ACTUAL">
  1091. <block type="math_number_property">
  1092. <mutation divisor_input="true"></mutation>
  1093. <field name="PROPERTY">DIVISIBLE_BY</field>
  1094. <value name="NUMBER_TO_CHECK">
  1095. <block type="math_number">
  1096. <field name="NUM">42</field>
  1097. </block>
  1098. </value>
  1099. <value name="DIVISOR">
  1100. <block type="math_number">
  1101. <field name="NUM">2</field>
  1102. </block>
  1103. </value>
  1104. </block>
  1105. </value>
  1106. </block>
  1107. </next>
  1108. </block>
  1109. </next>
  1110. </block>
  1111. </next>
  1112. </block>
  1113. </next>
  1114. </block>
  1115. </next>
  1116. </block>
  1117. </next>
  1118. </block>
  1119. </next>
  1120. </block>
  1121. </next>
  1122. </block>
  1123. </statement>
  1124. </block>
  1125. <block type="procedures_defnoreturn" x="13" y="3738">
  1126. <field name="NAME">test round</field>
  1127. <comment pinned="false" h="80" w="160">Tests the "round" block.</comment>
  1128. <statement name="STACK">
  1129. <block type="unittest_assertequals" inline="false">
  1130. <value name="MESSAGE">
  1131. <block type="text">
  1132. <field name="TEXT">round</field>
  1133. </block>
  1134. </value>
  1135. <value name="ACTUAL">
  1136. <block type="math_round" inline="false">
  1137. <field name="OP">ROUND</field>
  1138. <value name="NUM">
  1139. <block type="math_number">
  1140. <field name="NUM">42.42</field>
  1141. </block>
  1142. </value>
  1143. </block>
  1144. </value>
  1145. <value name="EXPECTED">
  1146. <block type="math_number">
  1147. <field name="NUM">42</field>
  1148. </block>
  1149. </value>
  1150. <next>
  1151. <block type="unittest_assertequals" inline="false">
  1152. <value name="MESSAGE">
  1153. <block type="text">
  1154. <field name="TEXT">round up</field>
  1155. </block>
  1156. </value>
  1157. <value name="ACTUAL">
  1158. <block type="math_round" inline="false">
  1159. <field name="OP">ROUNDUP</field>
  1160. <value name="NUM">
  1161. <block type="math_number">
  1162. <field name="NUM">-42.42</field>
  1163. </block>
  1164. </value>
  1165. </block>
  1166. </value>
  1167. <value name="EXPECTED">
  1168. <block type="math_number">
  1169. <field name="NUM">-42</field>
  1170. </block>
  1171. </value>
  1172. <next>
  1173. <block type="unittest_assertequals" inline="false">
  1174. <value name="MESSAGE">
  1175. <block type="text">
  1176. <field name="TEXT">round down</field>
  1177. </block>
  1178. </value>
  1179. <value name="ACTUAL">
  1180. <block type="math_round" inline="false">
  1181. <field name="OP">ROUNDDOWN</field>
  1182. <value name="NUM">
  1183. <block type="math_number">
  1184. <field name="NUM">42.42</field>
  1185. </block>
  1186. </value>
  1187. </block>
  1188. </value>
  1189. <value name="EXPECTED">
  1190. <block type="math_number">
  1191. <field name="NUM">42</field>
  1192. </block>
  1193. </value>
  1194. </block>
  1195. </next>
  1196. </block>
  1197. </next>
  1198. </block>
  1199. </statement>
  1200. </block>
  1201. <block type="procedures_defnoreturn" x="13" y="4038">
  1202. <field name="NAME">test change</field>
  1203. <comment pinned="false" h="80" w="160">Tests the "change" block.</comment>
  1204. <statement name="STACK">
  1205. <block type="variables_set" inline="false">
  1206. <field name="VAR">varToChange</field>
  1207. <value name="VALUE">
  1208. <block type="math_number">
  1209. <field name="NUM">100</field>
  1210. </block>
  1211. </value>
  1212. <next>
  1213. <block type="math_change" inline="false">
  1214. <field name="VAR">varToChange</field>
  1215. <value name="DELTA">
  1216. <block type="math_number">
  1217. <field name="NUM">42</field>
  1218. </block>
  1219. </value>
  1220. <next>
  1221. <block type="unittest_assertequals" inline="false">
  1222. <value name="MESSAGE">
  1223. <block type="text">
  1224. <field name="TEXT">change</field>
  1225. </block>
  1226. </value>
  1227. <value name="ACTUAL">
  1228. <block type="variables_get">
  1229. <field name="VAR">varToChange</field>
  1230. </block>
  1231. </value>
  1232. <value name="EXPECTED">
  1233. <block type="math_number">
  1234. <field name="NUM">142</field>
  1235. </block>
  1236. </value>
  1237. </block>
  1238. </next>
  1239. </block>
  1240. </next>
  1241. </block>
  1242. </statement>
  1243. </block>
  1244. <block type="procedures_defnoreturn" x="13" y="4238">
  1245. <field name="NAME">test operations on list</field>
  1246. <comment pinned="false" h="80" w="160">Tests the "list operation" blocks.</comment>
  1247. <statement name="STACK">
  1248. <block type="unittest_assertequals" inline="false">
  1249. <value name="MESSAGE">
  1250. <block type="text">
  1251. <field name="TEXT">sum</field>
  1252. </block>
  1253. </value>
  1254. <value name="ACTUAL">
  1255. <block type="math_on_list" inline="false">
  1256. <mutation op="SUM"></mutation>
  1257. <field name="OP">SUM</field>
  1258. <value name="LIST">
  1259. <block type="lists_create_with" inline="true">
  1260. <mutation items="3"></mutation>
  1261. <value name="ADD0">
  1262. <block type="math_number">
  1263. <field name="NUM">3</field>
  1264. </block>
  1265. </value>
  1266. <value name="ADD1">
  1267. <block type="math_number">
  1268. <field name="NUM">4</field>
  1269. </block>
  1270. </value>
  1271. <value name="ADD2">
  1272. <block type="math_number">
  1273. <field name="NUM">5</field>
  1274. </block>
  1275. </value>
  1276. </block>
  1277. </value>
  1278. </block>
  1279. </value>
  1280. <value name="EXPECTED">
  1281. <block type="math_number">
  1282. <field name="NUM">12</field>
  1283. </block>
  1284. </value>
  1285. <next>
  1286. <block type="unittest_assertequals" inline="false">
  1287. <value name="MESSAGE">
  1288. <block type="text">
  1289. <field name="TEXT">min</field>
  1290. </block>
  1291. </value>
  1292. <value name="ACTUAL">
  1293. <block type="math_on_list" inline="false">
  1294. <mutation op="MIN"></mutation>
  1295. <field name="OP">MIN</field>
  1296. <value name="LIST">
  1297. <block type="lists_create_with" inline="true">
  1298. <mutation items="3"></mutation>
  1299. <value name="ADD0">
  1300. <block type="math_number">
  1301. <field name="NUM">3</field>
  1302. </block>
  1303. </value>
  1304. <value name="ADD1">
  1305. <block type="math_number">
  1306. <field name="NUM">4</field>
  1307. </block>
  1308. </value>
  1309. <value name="ADD2">
  1310. <block type="math_number">
  1311. <field name="NUM">5</field>
  1312. </block>
  1313. </value>
  1314. </block>
  1315. </value>
  1316. </block>
  1317. </value>
  1318. <value name="EXPECTED">
  1319. <block type="math_number">
  1320. <field name="NUM">3</field>
  1321. </block>
  1322. </value>
  1323. <next>
  1324. <block type="unittest_assertequals" inline="false">
  1325. <value name="MESSAGE">
  1326. <block type="text">
  1327. <field name="TEXT">max</field>
  1328. </block>
  1329. </value>
  1330. <value name="ACTUAL">
  1331. <block type="math_on_list" inline="false">
  1332. <mutation op="MAX"></mutation>
  1333. <field name="OP">MAX</field>
  1334. <value name="LIST">
  1335. <block type="lists_create_with" inline="true">
  1336. <mutation items="3"></mutation>
  1337. <value name="ADD0">
  1338. <block type="math_number">
  1339. <field name="NUM">3</field>
  1340. </block>
  1341. </value>
  1342. <value name="ADD1">
  1343. <block type="math_number">
  1344. <field name="NUM">4</field>
  1345. </block>
  1346. </value>
  1347. <value name="ADD2">
  1348. <block type="math_number">
  1349. <field name="NUM">5</field>
  1350. </block>
  1351. </value>
  1352. </block>
  1353. </value>
  1354. </block>
  1355. </value>
  1356. <value name="EXPECTED">
  1357. <block type="math_number">
  1358. <field name="NUM">5</field>
  1359. </block>
  1360. </value>
  1361. <next>
  1362. <block type="unittest_assertequals" inline="false">
  1363. <value name="MESSAGE">
  1364. <block type="text">
  1365. <field name="TEXT">average</field>
  1366. </block>
  1367. </value>
  1368. <value name="ACTUAL">
  1369. <block type="math_on_list" inline="false">
  1370. <mutation op="AVERAGE"></mutation>
  1371. <field name="OP">AVERAGE</field>
  1372. <value name="LIST">
  1373. <block type="lists_create_with" inline="true">
  1374. <mutation items="3"></mutation>
  1375. <value name="ADD0">
  1376. <block type="math_number">
  1377. <field name="NUM">3</field>
  1378. </block>
  1379. </value>
  1380. <value name="ADD1">
  1381. <block type="math_number">
  1382. <field name="NUM">4</field>
  1383. </block>
  1384. </value>
  1385. <value name="ADD2">
  1386. <block type="math_number">
  1387. <field name="NUM">5</field>
  1388. </block>
  1389. </value>
  1390. </block>
  1391. </value>
  1392. </block>
  1393. </value>
  1394. <value name="EXPECTED">
  1395. <block type="math_number">
  1396. <field name="NUM">4</field>
  1397. </block>
  1398. </value>
  1399. <next>
  1400. <block type="unittest_assertequals" inline="false">
  1401. <value name="MESSAGE">
  1402. <block type="text">
  1403. <field name="TEXT">median</field>
  1404. </block>
  1405. </value>
  1406. <value name="ACTUAL">
  1407. <block type="math_on_list" inline="false">
  1408. <mutation op="MEDIAN"></mutation>
  1409. <field name="OP">MEDIAN</field>
  1410. <value name="LIST">
  1411. <block type="lists_create_with" inline="true">
  1412. <mutation items="4"></mutation>
  1413. <value name="ADD0">
  1414. <block type="math_number">
  1415. <field name="NUM">3</field>
  1416. </block>
  1417. </value>
  1418. <value name="ADD1">
  1419. <block type="math_number">
  1420. <field name="NUM">4</field>
  1421. </block>
  1422. </value>
  1423. <value name="ADD2">
  1424. <block type="math_number">
  1425. <field name="NUM">5</field>
  1426. </block>
  1427. </value>
  1428. <value name="ADD3">
  1429. <block type="math_number">
  1430. <field name="NUM">1</field>
  1431. </block>
  1432. </value>
  1433. </block>
  1434. </value>
  1435. </block>
  1436. </value>
  1437. <value name="EXPECTED">
  1438. <block type="math_number">
  1439. <field name="NUM">3.5</field>
  1440. </block>
  1441. </value>
  1442. <next>
  1443. <block type="unittest_assertequals">
  1444. <value name="MESSAGE">
  1445. <block type="text">
  1446. <field name="TEXT">modes</field>
  1447. </block>
  1448. </value>
  1449. <value name="ACTUAL">
  1450. <block type="math_on_list" inline="false">
  1451. <mutation op="MODE"></mutation>
  1452. <field name="OP">MODE</field>
  1453. <value name="LIST">
  1454. <block type="lists_create_with" inline="true">
  1455. <mutation items="3"></mutation>
  1456. <value name="ADD0">
  1457. <block type="math_number">
  1458. <field name="NUM">3</field>
  1459. </block>
  1460. </value>
  1461. <value name="ADD1">
  1462. <block type="math_number">
  1463. <field name="NUM">4</field>
  1464. </block>
  1465. </value>
  1466. <value name="ADD2">
  1467. <block type="math_number">
  1468. <field name="NUM">3</field>
  1469. </block>
  1470. </value>
  1471. </block>
  1472. </value>
  1473. </block>
  1474. </value>
  1475. <value name="EXPECTED">
  1476. <block type="lists_create_with" inline="true">
  1477. <mutation items="1"></mutation>
  1478. <value name="ADD0">
  1479. <block type="math_number">
  1480. <field name="NUM">3</field>
  1481. </block>
  1482. </value>
  1483. </block>
  1484. </value>
  1485. <next>
  1486. <block type="unittest_assertequals">
  1487. <value name="MESSAGE">
  1488. <block type="text">
  1489. <field name="TEXT">modes multiple</field>
  1490. </block>
  1491. </value>
  1492. <value name="ACTUAL">
  1493. <block type="math_on_list" inline="false">
  1494. <mutation op="MODE"></mutation>
  1495. <field name="OP">MODE</field>
  1496. <value name="LIST">
  1497. <block type="lists_create_with" inline="true">
  1498. <mutation items="5"></mutation>
  1499. <value name="ADD0">
  1500. <block type="math_number">
  1501. <field name="NUM">3</field>
  1502. </block>
  1503. </value>
  1504. <value name="ADD1">
  1505. <block type="math_number">
  1506. <field name="NUM">4</field>
  1507. </block>
  1508. </value>
  1509. <value name="ADD2">
  1510. <block type="math_number">
  1511. <field name="NUM">3</field>
  1512. </block>
  1513. </value>
  1514. <value name="ADD3">
  1515. <block type="math_number">
  1516. <field name="NUM">1</field>
  1517. </block>
  1518. </value>
  1519. <value name="ADD4">
  1520. <block type="math_number">
  1521. <field name="NUM">4</field>
  1522. </block>
  1523. </value>
  1524. </block>
  1525. </value>
  1526. </block>
  1527. </value>
  1528. <value name="EXPECTED">
  1529. <block type="lists_create_with" inline="true">
  1530. <mutation items="2"></mutation>
  1531. <value name="ADD0">
  1532. <block type="math_number">
  1533. <field name="NUM">3</field>
  1534. </block>
  1535. </value>
  1536. <value name="ADD1">
  1537. <block type="math_number">
  1538. <field name="NUM">4</field>
  1539. </block>
  1540. </value>
  1541. </block>
  1542. </value>
  1543. <next>
  1544. <block type="unittest_assertequals" inline="false">
  1545. <value name="MESSAGE">
  1546. <block type="text">
  1547. <field name="TEXT">standard dev</field>
  1548. </block>
  1549. </value>
  1550. <value name="ACTUAL">
  1551. <block type="math_on_list" inline="false">
  1552. <mutation op="STD_DEV"></mutation>
  1553. <field name="OP">STD_DEV</field>
  1554. <value name="LIST">
  1555. <block type="lists_create_with" inline="true">
  1556. <mutation items="3"></mutation>
  1557. <value name="ADD0">
  1558. <block type="math_number">
  1559. <field name="NUM">3</field>
  1560. </block>
  1561. </value>
  1562. <value name="ADD1">
  1563. <block type="math_number">
  1564. <field name="NUM">3</field>
  1565. </block>
  1566. </value>
  1567. <value name="ADD2">
  1568. <block type="math_number">
  1569. <field name="NUM">3</field>
  1570. </block>
  1571. </value>
  1572. </block>
  1573. </value>
  1574. </block>
  1575. </value>
  1576. <value name="EXPECTED">
  1577. <block type="math_number">
  1578. <field name="NUM">0</field>
  1579. </block>
  1580. </value>
  1581. <next>
  1582. <block type="unittest_assertvalue" inline="false">
  1583. <field name="EXPECTED">TRUE</field>
  1584. <value name="MESSAGE">
  1585. <block type="text">
  1586. <field name="TEXT">random</field>
  1587. </block>
  1588. </value>
  1589. <value name="ACTUAL">
  1590. <block type="logic_compare" inline="false">
  1591. <field name="OP">GT</field>
  1592. <value name="A">
  1593. <block type="lists_indexOf" inline="false">
  1594. <field name="END">FIRST</field>
  1595. <value name="VALUE">
  1596. <block type="lists_create_with" inline="true">
  1597. <mutation items="3"></mutation>
  1598. <value name="ADD0">
  1599. <block type="math_number">
  1600. <field name="NUM">3</field>
  1601. </block>
  1602. </value>
  1603. <value name="ADD1">
  1604. <block type="math_number">
  1605. <field name="NUM">4</field>
  1606. </block>
  1607. </value>
  1608. <value name="ADD2">
  1609. <block type="math_number">
  1610. <field name="NUM">5</field>
  1611. </block>
  1612. </value>
  1613. </block>
  1614. </value>
  1615. <value name="FIND">
  1616. <block type="math_on_list" inline="false">
  1617. <mutation op="RANDOM"></mutation>
  1618. <field name="OP">RANDOM</field>
  1619. <value name="LIST">
  1620. <block type="lists_create_with" inline="false">
  1621. <mutation items="3"></mutation>
  1622. <value name="ADD0">
  1623. <block type="math_number">
  1624. <field name="NUM">3</field>
  1625. </block>
  1626. </value>
  1627. <value name="ADD1">
  1628. <block type="math_number">
  1629. <field name="NUM">4</field>
  1630. </block>
  1631. </value>
  1632. <value name="ADD2">
  1633. <block type="math_number">
  1634. <field name="NUM">5</field>
  1635. </block>
  1636. </value>
  1637. </block>
  1638. </value>
  1639. </block>
  1640. </value>
  1641. </block>
  1642. </value>
  1643. <value name="B">
  1644. <block type="math_number">
  1645. <field name="NUM">0</field>
  1646. </block>
  1647. </value>
  1648. </block>
  1649. </value>
  1650. </block>
  1651. </next>
  1652. </block>
  1653. </next>
  1654. </block>
  1655. </next>
  1656. </block>
  1657. </next>
  1658. </block>
  1659. </next>
  1660. </block>
  1661. </next>
  1662. </block>
  1663. </next>
  1664. </block>
  1665. </next>
  1666. </block>
  1667. </statement>
  1668. </block>
  1669. <block type="procedures_defnoreturn" x="13" y="5213">
  1670. <field name="NAME">test mod</field>
  1671. <comment pinned="false" h="80" w="160">Tests the "mod" block.</comment>
  1672. <statement name="STACK">
  1673. <block type="unittest_assertequals" inline="false">
  1674. <value name="MESSAGE">
  1675. <block type="text">
  1676. <field name="TEXT">mod</field>
  1677. </block>
  1678. </value>
  1679. <value name="ACTUAL">
  1680. <block type="math_modulo">
  1681. <value name="DIVIDEND">
  1682. <block type="math_number">
  1683. <field name="NUM">42</field>
  1684. </block>
  1685. </value>
  1686. <value name="DIVISOR">
  1687. <block type="math_number">
  1688. <field name="NUM">5</field>
  1689. </block>
  1690. </value>
  1691. </block>
  1692. </value>
  1693. <value name="EXPECTED">
  1694. <block type="math_number">
  1695. <field name="NUM">2</field>
  1696. </block>
  1697. </value>
  1698. </block>
  1699. </statement>
  1700. </block>
  1701. <block type="procedures_defnoreturn" x="13" y="5363">
  1702. <field name="NAME">test constraint</field>
  1703. <comment pinned="false" h="80" w="160">Tests the "constrain" block.</comment>
  1704. <statement name="STACK">
  1705. <block type="unittest_assertequals" inline="false">
  1706. <value name="MESSAGE">
  1707. <block type="text">
  1708. <field name="TEXT">constraint</field>
  1709. </block>
  1710. </value>
  1711. <value name="ACTUAL">
  1712. <block type="math_constrain">
  1713. <value name="VALUE">
  1714. <block type="math_number">
  1715. <field name="NUM">100</field>
  1716. </block>
  1717. </value>
  1718. <value name="LOW">
  1719. <block type="math_number">
  1720. <field name="NUM">0</field>
  1721. </block>
  1722. </value>
  1723. <value name="HIGH">
  1724. <block type="math_number">
  1725. <field name="NUM">42</field>
  1726. </block>
  1727. </value>
  1728. </block>
  1729. </value>
  1730. <value name="EXPECTED">
  1731. <block type="math_number">
  1732. <field name="NUM">42</field>
  1733. </block>
  1734. </value>
  1735. </block>
  1736. </statement>
  1737. </block>
  1738. <block type="procedures_defnoreturn" x="13" y="5513">
  1739. <field name="NAME">test random integer</field>
  1740. <comment pinned="false" h="80" w="160">Tests the "random integer" block.</comment>
  1741. <statement name="STACK">
  1742. <block type="variables_set" inline="false">
  1743. <field name="VAR">rand</field>
  1744. <value name="VALUE">
  1745. <block type="math_random_int">
  1746. <value name="FROM">
  1747. <block type="math_number">
  1748. <field name="NUM">5</field>
  1749. </block>
  1750. </value>
  1751. <value name="TO">
  1752. <block type="math_number">
  1753. <field name="NUM">10</field>
  1754. </block>
  1755. </value>
  1756. </block>
  1757. </value>
  1758. <next>
  1759. <block type="unittest_assertvalue" inline="false">
  1760. <field name="EXPECTED">TRUE</field>
  1761. <value name="MESSAGE">
  1762. <block type="text">
  1763. <field name="TEXT">randRange</field>
  1764. </block>
  1765. </value>
  1766. <value name="ACTUAL">
  1767. <block type="logic_operation">
  1768. <field name="OP">AND</field>
  1769. <value name="A">
  1770. <block type="logic_compare">
  1771. <field name="OP">GTE</field>
  1772. <value name="A">
  1773. <block type="variables_get">
  1774. <field name="VAR">rand</field>
  1775. </block>
  1776. </value>
  1777. <value name="B">
  1778. <block type="math_number">
  1779. <field name="NUM">5</field>
  1780. </block>
  1781. </value>
  1782. </block>
  1783. </value>
  1784. <value name="B">
  1785. <block type="logic_compare">
  1786. <field name="OP">LTE</field>
  1787. <value name="A">
  1788. <block type="variables_get">
  1789. <field name="VAR">rand</field>
  1790. </block>
  1791. </value>
  1792. <value name="B">
  1793. <block type="math_number">
  1794. <field name="NUM">10</field>
  1795. </block>
  1796. </value>
  1797. </block>
  1798. </value>
  1799. </block>
  1800. </value>
  1801. <next>
  1802. <block type="unittest_assertvalue" inline="false">
  1803. <field name="EXPECTED">TRUE</field>
  1804. <value name="MESSAGE">
  1805. <block type="text">
  1806. <field name="TEXT">randInteger</field>
  1807. </block>
  1808. </value>
  1809. <value name="ACTUAL">
  1810. <block type="math_number_property">
  1811. <mutation divisor_input="false"></mutation>
  1812. <field name="PROPERTY">WHOLE</field>
  1813. <value name="NUMBER_TO_CHECK">
  1814. <block type="variables_get">
  1815. <field name="VAR">rand</field>
  1816. </block>
  1817. </value>
  1818. </block>
  1819. </value>
  1820. </block>
  1821. </next>
  1822. </block>
  1823. </next>
  1824. </block>
  1825. </statement>
  1826. </block>
  1827. <block type="procedures_defnoreturn" x="13" y="5763">
  1828. <field name="NAME">test random fraction</field>
  1829. <comment pinned="false" h="80" w="160">Tests the "random fraction" block.</comment>
  1830. <statement name="STACK">
  1831. <block type="variables_set" inline="false">
  1832. <field name="VAR">rand</field>
  1833. <value name="VALUE">
  1834. <block type="math_random_float"></block>
  1835. </value>
  1836. <next>
  1837. <block type="unittest_assertvalue" inline="false">
  1838. <field name="EXPECTED">TRUE</field>
  1839. <value name="MESSAGE">
  1840. <block type="text">
  1841. <field name="TEXT">randFloat</field>
  1842. </block>
  1843. </value>
  1844. <value name="ACTUAL">
  1845. <block type="logic_operation">
  1846. <field name="OP">AND</field>
  1847. <value name="A">
  1848. <block type="logic_compare">
  1849. <field name="OP">GTE</field>
  1850. <value name="A">
  1851. <block type="variables_get">
  1852. <field name="VAR">rand</field>
  1853. </block>
  1854. </value>
  1855. <value name="B">
  1856. <block type="math_number">
  1857. <field name="NUM">0</field>
  1858. </block>
  1859. </value>
  1860. </block>
  1861. </value>
  1862. <value name="B">
  1863. <block type="logic_compare">
  1864. <field name="OP">LTE</field>
  1865. <value name="A">
  1866. <block type="variables_get">
  1867. <field name="VAR">rand</field>
  1868. </block>
  1869. </value>
  1870. <value name="B">
  1871. <block type="math_number">
  1872. <field name="NUM">1</field>
  1873. </block>
  1874. </value>
  1875. </block>
  1876. </value>
  1877. </block>
  1878. </value>
  1879. </block>
  1880. </next>
  1881. </block>
  1882. </statement>
  1883. </block>
  1884. </xml>