test_constructors_models.py 33 KB

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