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