test_constructors_models.py 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. import unittest
  2. import sys
  3. import os
  4. from utils import execute, kill, run_file, run_barebone
  5. def flatten(lst):
  6. new_lst = []
  7. for f in lst:
  8. if isinstance(f, (list, tuple)):
  9. new_lst.extend(flatten(f))
  10. else:
  11. new_lst.append(f)
  12. return new_lst
  13. bottom = ['"instantiate_bottom"',
  14. '"node"', '"Class"', 'true',
  15. '"node"', '"Type"', 'true',
  16. '"node"', '"__String"', 'true',
  17. '"value"', '"__name"', '"name"', 'true',
  18. '"edge"', '"Attribute"', '"Class"', '"Type"', 'true',
  19. '"edge"', '"__Name"', '"Attribute"', '"__String"', 'true',
  20. '"edge"', '"Association"', '"Class"', '"Class"', 'true',
  21. '"edge"', '"Inheritance"', '"Class"', '"Class"', 'true',
  22. '"edge"', '"__name_edge"', '"__Name"', '"__name"', 'true',
  23. '"edge"', '"__inh_1"', '"Association"', '"Class"', 'true',
  24. '"edge"', '"__inh_2"', '"Attribute"', '"Class"', 'true',
  25. '"value"', '"__attribute"', '"attribute"', 'true',
  26. '"edge"', '"__attribute_edge"', '"Attribute"', '"__attribute"', 'false',
  27. 1,
  28. ]
  29. retype = ['"retype_model"',
  30. 1,
  31. 1,
  32. 1, '"Inheritance"',
  33. 'true',
  34. '"Class"', '"Class"', 'true',
  35. '"Type"', '"Type"', 'true',
  36. '"__String"', '"Type"', 'true',
  37. '"Attribute"', '"Attribute"', 'true',
  38. '"__Name"', '"Attribute"', 'true',
  39. '"Association"', '"Association"', 'true',
  40. '"Inheritance"', '"Association"', 'true',
  41. '"__inh_1"', '"Inheritance"', 'true',
  42. '"__inh2"', '"Inheritance"', 'true',
  43. '"__name"', '"__String"', 'true',
  44. '"__name_edge"', '"__Name"', 'true',
  45. '"__attribute"', '"__String"', 'true',
  46. '"__attribute_edge"', '"__Name"', 'false',
  47. ]
  48. def function_call(func, paramA, paramB):
  49. return ['"output"', '"call"',
  50. '"access"',
  51. '"resolve"', '"%s"' % func,
  52. '3',
  53. '"const"', 3,
  54. '"call"',
  55. '"access"',
  56. '"resolve"', '"dict_read"',
  57. '2',
  58. '"call"',
  59. '"access"',
  60. '"resolve"', '"dict_read"',
  61. '2',
  62. '"const"', 3,
  63. '"const"', '"model"',
  64. 'false',
  65. '"const"', '"%s"' % paramA,
  66. 'false',
  67. '"call"',
  68. '"access"',
  69. '"resolve"', '"dict_read"',
  70. '2',
  71. '"call"',
  72. '"access"',
  73. '"resolve"', '"dict_read"',
  74. '2',
  75. '"const"', 2,
  76. '"const"', '"model"',
  77. 'false',
  78. '"const"', '"%s"' % paramB,
  79. 'false',
  80. 'false',
  81. 'true',
  82. ]
  83. class TestConstructorsModels(unittest.TestCase):
  84. def test_constructors_instantiate_bottom(self):
  85. commands = bottom + [
  86. '"output"', '"const"', '3',
  87. 'true',
  88. '"return"', 'true',
  89. '"const"', 'true',
  90. ]
  91. self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
  92. def test_constructors_instantiate_model(self):
  93. commands = bottom + [
  94. '"instantiate_model"',
  95. 1,
  96. 1, '"Inheritance"',
  97. '"Type"', '"Integer"',
  98. 'false',
  99. 'false',
  100. 'true',
  101. '"Class"', '"Place"',
  102. 'true',
  103. '"tokens"', '"Integer"', 'false',
  104. 'false',
  105. 'true',
  106. '"Class"', '"Transition"',
  107. 'false',
  108. 'false',
  109. 'true',
  110. '"Association"', '"P2T"', '"Place"', '"Transition"',
  111. 'true',
  112. '"weight"', '"Integer"', 'false',
  113. 'false',
  114. 'true',
  115. '"Association"', '"T2P"', '"Transition"', '"Place"',
  116. 'true',
  117. '"weight"', '"Integer"', 'false',
  118. 'false',
  119. 'false',
  120. 2,
  121. '"instantiate_model"',
  122. 2,
  123. 1, '"Inheritance"',
  124. '"Place"', '"p1"',
  125. 'false',
  126. 'true',
  127. '"tokens"', '5', 'false',
  128. 'true',
  129. '"Transition"', '"t1"',
  130. 'false',
  131. 'false',
  132. 'true',
  133. '"P2T"', '""', '"p1"', '"t1"',
  134. 'false',
  135. 'true',
  136. '"weight"', '1', 'false',
  137. 'true',
  138. '"T2P"', '""', '"t1"', '"p1"',
  139. 'false',
  140. 'true',
  141. '"weight"', '2', 'false',
  142. 'false',
  143. 3,
  144. '"output"', '"const"', '3',
  145. 'true',
  146. '"return"', 'true',
  147. '"const"', 'true',
  148. ]
  149. self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
  150. def test_constructors_retype_model(self):
  151. commands = bottom + retype + [
  152. '"output"', '"const"', '3',
  153. 'true',
  154. '"return"', 'true',
  155. '"const"', 'true',
  156. ]
  157. self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
  158. def test_constructors_instantiate_model_inheritance(self):
  159. commands = bottom + [
  160. '"instantiate_model"',
  161. 1,
  162. 1, '"Inheritance"',
  163. '"Class"', '"A"',
  164. 'true',
  165. '"a"', '{"value": "Integer"}', 'false',
  166. 'false',
  167. 'true',
  168. '"Class"', '"B"',
  169. 'true',
  170. '"b"', '{"value": "Integer"}', 'false',
  171. 'false',
  172. 'true',
  173. '"Inheritance"', '"b_inherits_from_a"', '"B"', '"A"',
  174. 'false',
  175. 'false',
  176. 'false',
  177. 2,
  178. '"instantiate_model"',
  179. 2,
  180. 1, '"Inheritance"',
  181. '"A"', '"a1"',
  182. 'false',
  183. 'true',
  184. '"a"', '1', 'false',
  185. 'true',
  186. '"B"', '"b1"',
  187. 'false',
  188. 'true',
  189. '"a"', '2', 'true',
  190. '"b"', '3', 'false',
  191. 'false',
  192. 3,
  193. '"output"', '"const"', '3',
  194. 'true',
  195. '"return"', 'true',
  196. '"const"', 'true',
  197. ]
  198. self.assertTrue(run_barebone(flatten(commands), ['3'], 1))
  199. def test_constructors_conformance_metametamodel(self):
  200. commands = bottom + retype + [
  201. '"output"', '"call"',
  202. '"access"',
  203. '"resolve"', '"conformance_scd"',
  204. '1',
  205. '"const"', 1,
  206. 'false',
  207. 'true',
  208. '"return"', 'true',
  209. '"const"', 'true',
  210. ]
  211. self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
  212. def test_constructors_conformance_metamodel(self):
  213. commands = bottom + retype + [
  214. '"instantiate_model"',
  215. 1,
  216. 1, '"Inheritance"',
  217. '"Class"', '"Place"',
  218. 'true',
  219. '"tokens"', '{"value": "Integer"}', 'false',
  220. 'false',
  221. 'true',
  222. '"Class"', '"Transition"',
  223. 'false',
  224. 'false',
  225. 'true',
  226. '"Association"', '"P2T"', '"Place"', '"Transition"',
  227. 'true',
  228. '"weight"', '{"value": "Integer"}', 'false',
  229. 'false',
  230. 'true',
  231. '"Association"', '"T2P"', '"Transition"', '"Place"',
  232. 'true',
  233. '"weight"', '{"value": "Integer"}', 'false',
  234. 'false',
  235. 'false',
  236. 2,
  237. '"output"', '"call"',
  238. '"access"',
  239. '"resolve"', '"conformance_scd"',
  240. '1',
  241. '"const"', 2,
  242. 'false',
  243. 'true',
  244. '"return"', 'true',
  245. '"const"', 'true',
  246. ]
  247. self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
  248. def test_constructors_conformance_model(self):
  249. commands = bottom + retype + [
  250. '"instantiate_model"',
  251. 1,
  252. 1, '"Inheritance"',
  253. '"Class"', '"Place"',
  254. 'true',
  255. '"tokens"', '{"value": "Integer"}', 'false',
  256. 'false',
  257. 'true',
  258. '"Class"', '"Transition"',
  259. 'false',
  260. 'false',
  261. 'true',
  262. '"Association"', '"P2T"', '"Place"', '"Transition"',
  263. 'true',
  264. '"weight"', '{"value": "Integer"}', 'false',
  265. 'false',
  266. 'true',
  267. '"Association"', '"T2P"', '"Transition"', '"Place"',
  268. 'true',
  269. '"weight"', '{"value": "Integer"}', 'false',
  270. 'false',
  271. 'false',
  272. 2,
  273. '"instantiate_model"',
  274. 2,
  275. 1, '"Inheritance"',
  276. '"Place"', '"p1"',
  277. 'false',
  278. 'true',
  279. '"tokens"', '5', 'false',
  280. 'true',
  281. '"Transition"', '"t1"',
  282. 'false',
  283. 'false',
  284. 'true',
  285. '"P2T"', '""', '"p1"', '"t1"',
  286. 'false',
  287. 'true',
  288. '"weight"', '1', 'false',
  289. 'true',
  290. '"T2P"', '""', '"t1"', '"p1"',
  291. 'false',
  292. 'true',
  293. '"weight"', '2', 'false',
  294. 'false',
  295. 3,
  296. '"output"', '"call"',
  297. '"access"',
  298. '"resolve"', '"conformance_scd"',
  299. '1',
  300. '"const"', 3,
  301. 'false',
  302. 'true',
  303. '"return"', 'true',
  304. '"const"', 'true',
  305. ]
  306. self.assertTrue(run_barebone(flatten(commands), ['OK'], 1))
  307. def test_constructors_is_direct_instance(self):
  308. commands = bottom + retype + [
  309. '"instantiate_model"',
  310. 1,
  311. 1, '"Inheritance"',
  312. '"Class"', '"A"',
  313. 'true',
  314. '"a"', '{"value": "Integer"}', 'false',
  315. 'false',
  316. 'true',
  317. '"Class"', '"B"',
  318. 'true',
  319. '"b"', '{"value": "Integer"}', 'false',
  320. 'false',
  321. 'true',
  322. '"Class"', '"C"',
  323. 'true',
  324. '"b"', '{"value": "Integer"}', 'true',
  325. '"c"', '{"value": "Integer"}', 'false',
  326. 'false',
  327. 'true',
  328. '"Inheritance"', '"__inh_1"', '"A"', '"B"',
  329. 'false',
  330. 'false',
  331. 'false',
  332. 2,
  333. '"instantiate_model"',
  334. 2,
  335. 1, '"Inheritance"',
  336. '"A"', '"a"',
  337. 'false',
  338. 'true',
  339. '"a"', '1', 'true',
  340. '"b"', '1', 'false',
  341. 'true',
  342. '"B"', '"b"',
  343. 'false',
  344. 'true',
  345. '"b"', '1', 'false',
  346. 'true',
  347. '"C"', '"c"',
  348. 'false',
  349. 'true',
  350. '"b"', '1', 'true',
  351. '"c"', '1', 'false',
  352. 'false',
  353. 3,
  354. ] + \
  355. function_call("is_direct_instance", "a", "A") + \
  356. function_call("is_direct_instance", "a", "B") + \
  357. function_call("is_direct_instance", "a", "C") + \
  358. function_call("is_direct_instance", "b", "A") + \
  359. function_call("is_direct_instance", "b", "B") + \
  360. function_call("is_direct_instance", "b", "C") + \
  361. function_call("is_direct_instance", "c", "A") + \
  362. function_call("is_direct_instance", "c", "B") + \
  363. function_call("is_direct_instance", "c", "C") + \
  364. ['"return"', 'true',
  365. '"const"', 'true',
  366. ]
  367. # Test in order:
  368. # a : A --> Yes
  369. # a : B --> No
  370. # a : C --> No
  371. # b : A --> No
  372. # b : B --> Yes
  373. # b : C --> No
  374. # c : A --> No
  375. # c : B --> No
  376. # c : C --> Yes
  377. self.assertTrue(run_barebone(flatten(commands), ['True', 'False', 'False', 'False', 'True', 'False', 'False', 'False', 'True'], 1))
  378. def test_constructors_is_nominal_instance(self):
  379. commands = bottom + retype + [
  380. '"instantiate_model"',
  381. 1,
  382. 1, '"Inheritance"',
  383. '"Class"', '"A"',
  384. 'true',
  385. '"a"', '{"value": "Integer"}', 'false',
  386. 'false',
  387. 'true',
  388. '"Class"', '"B"',
  389. 'true',
  390. '"b"', '{"value": "Integer"}', 'false',
  391. 'false',
  392. 'true',
  393. '"Class"', '"C"',
  394. 'true',
  395. '"b"', '{"value": "Integer"}', 'true',
  396. '"c"', '{"value": "Integer"}', 'false',
  397. 'false',
  398. 'true',
  399. '"Inheritance"', '"__inh_1"', '"A"', '"B"',
  400. 'false',
  401. 'false',
  402. 'false',
  403. 2,
  404. '"instantiate_model"',
  405. 2,
  406. 1, '"Inheritance"',
  407. '"A"', '"a"',
  408. 'false',
  409. 'true',
  410. '"a"', '1', 'true',
  411. '"b"', '1', 'false',
  412. 'true',
  413. '"B"', '"b"',
  414. 'false',
  415. 'true',
  416. '"b"', '1', 'false',
  417. 'true',
  418. '"C"', '"c"',
  419. 'false',
  420. 'true',
  421. '"b"', '1', 'true',
  422. '"c"', '1', 'false',
  423. 'false',
  424. 3, ] + \
  425. function_call("is_nominal_instance", "a", "A") + \
  426. function_call("is_nominal_instance", "a", "B") + \
  427. function_call("is_nominal_instance", "a", "C") + \
  428. function_call("is_nominal_instance", "b", "A") + \
  429. function_call("is_nominal_instance", "b", "B") + \
  430. function_call("is_nominal_instance", "b", "C") + \
  431. function_call("is_nominal_instance", "c", "A") + \
  432. function_call("is_nominal_instance", "c", "B") + \
  433. function_call("is_nominal_instance", "c", "C") + \
  434. [ '"return"', 'true',
  435. '"const"', 'true',
  436. ]
  437. # Test in order:
  438. # a : A --> Yes
  439. # a : B --> Yes
  440. # a : C --> No
  441. # b : A --> No
  442. # b : B --> Yes
  443. # b : C --> No
  444. # c : A --> No
  445. # c : B --> No
  446. # c : C --> Yes
  447. self.assertTrue(run_barebone(flatten(commands), ['True', 'True', 'False', 'False', 'True', 'False', 'False', 'False', 'True'], 1))
  448. def test_constructors_is_structural_instance(self):
  449. commands = bottom + retype + [
  450. '"instantiate_model"',
  451. 1,
  452. 1, '"Inheritance"',
  453. '"Class"', '"A"',
  454. 'true',
  455. '"a"', '{"value": "Integer"}', 'false',
  456. 'false',
  457. 'true',
  458. '"Class"', '"B"',
  459. 'true',
  460. '"b"', '{"value": "Integer"}', 'false',
  461. 'false',
  462. 'true',
  463. '"Class"', '"C"',
  464. 'true',
  465. '"b"', '{"value": "Integer"}', 'true',
  466. '"c"', '{"value": "Integer"}', 'false',
  467. 'false',
  468. 'true',
  469. '"Inheritance"', '"__inh_1"', '"A"', '"B"',
  470. 'false',
  471. 'false',
  472. 'false',
  473. 2,
  474. '"instantiate_model"',
  475. 2,
  476. 1, '"Inheritance"',
  477. '"A"', '"a"',
  478. 'false',
  479. 'true',
  480. '"a"', '1', 'false',
  481. 'true',
  482. '"B"', '"b"',
  483. 'false',
  484. 'true',
  485. '"b"', '1', 'false',
  486. 'true',
  487. '"C"', '"c"',
  488. 'false',
  489. 'true',
  490. '"b"', '1', 'true',
  491. '"c"', '1', 'false',
  492. 'false',
  493. 3, ] + \
  494. function_call("is_structural_instance", "a", "A") + \
  495. function_call("is_structural_instance", "a", "B") + \
  496. function_call("is_structural_instance", "a", "C") + \
  497. function_call("is_structural_instance", "b", "A") + \
  498. function_call("is_structural_instance", "b", "B") + \
  499. function_call("is_structural_instance", "b", "C") + \
  500. function_call("is_structural_instance", "c", "A") + \
  501. function_call("is_structural_instance", "c", "B") + \
  502. function_call("is_structural_instance", "c", "C") + \
  503. [ '"return"', 'true',
  504. '"const"', 'true',
  505. ]
  506. # Test in order:
  507. # a : A --> Yes
  508. # a : B --> No
  509. # a : C --> No
  510. # b : A --> No
  511. # b : B --> Yes
  512. # b : C --> No
  513. # c : A --> No
  514. # c : B --> Yes
  515. # c : C --> Yes
  516. self.assertTrue(run_barebone(flatten(commands), ['True', 'False', 'False', 'False', 'True', 'False', 'False', 'True', 'True'], 1))
  517. def test_constructors_readAttribute(self):
  518. commands = bottom + retype + [
  519. '"instantiate_model"',
  520. 1,
  521. 1, '"Inheritance"',
  522. '"Class"', '"Place"',
  523. 'true',
  524. '"tokens"', '{"value": "Integer"}', 'false',
  525. 'false',
  526. 'true',
  527. '"Class"', '"Transition"',
  528. 'false',
  529. 'false',
  530. 'true',
  531. '"Association"', '"P2T"', '"Place"', '"Transition"',
  532. 'true',
  533. '"weight"', '{"value": "Integer"}', 'false',
  534. 'false',
  535. 'true',
  536. '"Association"', '"T2P"', '"Transition"', '"Place"',
  537. 'true',
  538. '"weight"', '{"value": "Integer"}', 'false',
  539. 'false',
  540. 'false',
  541. 2,
  542. '"instantiate_model"',
  543. 2,
  544. 1, '"Inheritance"',
  545. '"Place"', '"p1"',
  546. 'false',
  547. 'true',
  548. '"tokens"', '5', 'false',
  549. 'true',
  550. '"Transition"', '"t1"',
  551. 'false',
  552. 'false',
  553. 'true',
  554. '"P2T"', '"arc1"', '"p1"', '"t1"',
  555. 'false',
  556. 'true',
  557. '"weight"', '1', 'false',
  558. 'true',
  559. '"T2P"', '"arc2"', '"t1"', '"p1"',
  560. 'false',
  561. 'true',
  562. '"weight"', '2', 'false',
  563. 'false',
  564. 3,
  565. '"output"', '"call"',
  566. '"access"',
  567. '"resolve"', '"readAttribute"',
  568. '3',
  569. '"const"', 3,
  570. '"call"',
  571. '"access"',
  572. '"resolve"', '"readElementByName"',
  573. '2',
  574. '"const"', 3,
  575. '"const"', '"p1"',
  576. 'false',
  577. '"const"', '"tokens"',
  578. 'false',
  579. 'true',
  580. '"output"', '"call"',
  581. '"access"',
  582. '"resolve"', '"readAttribute"',
  583. '3',
  584. '"const"', 3,
  585. '"call"',
  586. '"access"',
  587. '"resolve"', '"readElementByName"',
  588. '2',
  589. '"const"', 3,
  590. '"const"', '"arc1"',
  591. 'false',
  592. '"const"', '"weight"',
  593. 'false',
  594. 'true',
  595. '"output"', '"call"',
  596. '"access"',
  597. '"resolve"', '"readAttribute"',
  598. '3',
  599. '"const"', 3,
  600. '"call"',
  601. '"access"',
  602. '"resolve"', '"readElementByName"',
  603. '2',
  604. '"const"', 3,
  605. '"const"', '"arc2"',
  606. 'false',
  607. '"const"', '"weight"',
  608. 'false',
  609. 'true',
  610. '"return"', 'true',
  611. '"const"', 'true',
  612. ]
  613. self.assertTrue(run_barebone(flatten(commands), ['5', '1', '2'], 1))
  614. def test_constructors_readAndSetAttribute(self):
  615. commands = bottom + retype + [
  616. '"instantiate_model"',
  617. 1,
  618. 1, '"Inheritance"',
  619. '"Class"', '"Place"',
  620. 'true',
  621. '"tokens"', '{"value": "Integer"}', 'false',
  622. 'false',
  623. 'true',
  624. '"Class"', '"Transition"',
  625. 'false',
  626. 'false',
  627. 'true',
  628. '"Association"', '"P2T"', '"Place"', '"Transition"',
  629. 'true',
  630. '"weight"', '{"value": "Integer"}', 'false',
  631. 'false',
  632. 'true',
  633. '"Association"', '"T2P"', '"Transition"', '"Place"',
  634. 'true',
  635. '"weight"', '{"value": "Integer"}', 'false',
  636. 'false',
  637. 'false',
  638. 2,
  639. '"instantiate_model"',
  640. 2,
  641. 1, '"Inheritance"',
  642. '"Place"', '"p1"',
  643. 'false',
  644. 'true',
  645. '"tokens"', '5', 'false',
  646. 'true',
  647. '"Transition"', '"t1"',
  648. 'false',
  649. 'false',
  650. 'true',
  651. '"P2T"', '"arc1"', '"p1"', '"t1"',
  652. 'false',
  653. 'true',
  654. '"weight"', '1', 'false',
  655. 'true',
  656. '"T2P"', '"arc2"', '"t1"', '"p1"',
  657. 'false',
  658. 'true',
  659. '"weight"', '2', 'false',
  660. 'false',
  661. 3,
  662. '"output"', '"call"',
  663. '"access"',
  664. '"resolve"', '"readAttribute"',
  665. '3',
  666. '"const"', 3,
  667. '"call"',
  668. '"access"',
  669. '"resolve"', '"readElementByName"',
  670. '2',
  671. '"const"', 3,
  672. '"const"', '"p1"',
  673. 'false',
  674. '"const"', '"tokens"',
  675. 'false',
  676. 'true',
  677. '"output"', '"call"',
  678. '"access"',
  679. '"resolve"', '"readAttribute"',
  680. '3',
  681. '"const"', 3,
  682. '"call"',
  683. '"access"',
  684. '"resolve"', '"readElementByName"',
  685. '2',
  686. '"const"', 3,
  687. '"const"', '"arc1"',
  688. 'false',
  689. '"const"', '"weight"',
  690. 'false',
  691. 'true',
  692. '"output"', '"call"',
  693. '"access"',
  694. '"resolve"', '"readAttribute"',
  695. '3',
  696. '"const"', 3,
  697. '"call"',
  698. '"access"',
  699. '"resolve"', '"readElementByName"',
  700. '2',
  701. '"const"', 3,
  702. '"const"', '"arc2"',
  703. 'false',
  704. '"const"', '"weight"',
  705. 'false',
  706. 'true',
  707. '"call"',
  708. '"access"',
  709. '"resolve"', '"setAttribute"',
  710. '4',
  711. '"const"', 3,
  712. '"call"',
  713. '"access"',
  714. '"resolve"', '"readElementByName"',
  715. '2',
  716. '"const"', 3,
  717. '"const"', '"p1"',
  718. 'false',
  719. '"const"', '"tokens"',
  720. '"const"', '10',
  721. 'true',
  722. '"call"',
  723. '"access"',
  724. '"resolve"', '"setAttribute"',
  725. '4',
  726. '"const"', 3,
  727. '"call"',
  728. '"access"',
  729. '"resolve"', '"readElementByName"',
  730. '2',
  731. '"const"', 3,
  732. '"const"', '"arc1"',
  733. 'false',
  734. '"const"', '"weight"',
  735. '"const"', '16',
  736. 'true',
  737. '"call"',
  738. '"access"',
  739. '"resolve"', '"setAttribute"',
  740. '4',
  741. '"const"', 3,
  742. '"call"',
  743. '"access"',
  744. '"resolve"', '"readElementByName"',
  745. '2',
  746. '"const"', 3,
  747. '"const"', '"arc2"',
  748. 'false',
  749. '"const"', '"weight"',
  750. '"const"', '30',
  751. 'true',
  752. '"output"', '"call"',
  753. '"access"',
  754. '"resolve"', '"readAttribute"',
  755. '3',
  756. '"const"', 3,
  757. '"call"',
  758. '"access"',
  759. '"resolve"', '"readElementByName"',
  760. '2',
  761. '"const"', 3,
  762. '"const"', '"p1"',
  763. 'false',
  764. '"const"', '"tokens"',
  765. 'false',
  766. 'true',
  767. '"output"', '"call"',
  768. '"access"',
  769. '"resolve"', '"readAttribute"',
  770. '3',
  771. '"const"', 3,
  772. '"call"',
  773. '"access"',
  774. '"resolve"', '"readElementByName"',
  775. '2',
  776. '"const"', 3,
  777. '"const"', '"arc1"',
  778. 'false',
  779. '"const"', '"weight"',
  780. 'false',
  781. 'true',
  782. '"output"', '"call"',
  783. '"access"',
  784. '"resolve"', '"readAttribute"',
  785. '3',
  786. '"const"', 3,
  787. '"call"',
  788. '"access"',
  789. '"resolve"', '"readElementByName"',
  790. '2',
  791. '"const"', 3,
  792. '"const"', '"arc2"',
  793. 'false',
  794. '"const"', '"weight"',
  795. 'false',
  796. 'true',
  797. '"return"', 'true',
  798. '"const"', 'true',
  799. ]
  800. self.assertTrue(run_barebone(flatten(commands), ['5', '1', '2', '10', '16', '30'], 1))