testdata.json 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. {
  2. "send-receive": {
  3. "input": "SYSTEM: task_a = send*;\nSYSTEM: task_b = receive*;\nINTERACTION: task_a:send -> task_b:receive;",
  4. "expected": {
  5. "systems": {
  6. "task_a": {
  7. "type": "System",
  8. "id": "task_a",
  9. "body": [{
  10. "type": "Sequence",
  11. "body": [{
  12. "type": "Behavior",
  13. "id": "send",
  14. "scope": {
  15. "min": 0,
  16. "max": null
  17. }
  18. }],
  19. "scope": {
  20. "min": 1,
  21. "max": 1
  22. }
  23. }],
  24. "refs": [
  25. "send"
  26. ],
  27. "properties": {},
  28. "scope": {
  29. "min": 1,
  30. "max": 1
  31. }
  32. },
  33. "task_b": {
  34. "type": "System",
  35. "id": "task_b",
  36. "body": [{
  37. "type": "Sequence",
  38. "body": [{
  39. "type": "Behavior",
  40. "id": "receive",
  41. "scope": {
  42. "min": 0,
  43. "max": null
  44. }
  45. }],
  46. "scope": {
  47. "min": 1,
  48. "max": 1
  49. }
  50. }],
  51. "refs": [
  52. "receive"
  53. ],
  54. "properties": {},
  55. "scope": {
  56. "min": 1,
  57. "max": 1
  58. }
  59. }
  60. },
  61. "behaviors": {
  62. "send": {
  63. "type": "Behavior",
  64. "id": "send",
  65. "body": [],
  66. "refs": [],
  67. "properties": {}
  68. },
  69. "receive": {
  70. "type": "Behavior",
  71. "id": "receive",
  72. "body": [],
  73. "refs": [],
  74. "properties": {}
  75. }
  76. },
  77. "interactions": [{
  78. "type": "Then",
  79. "body": [{
  80. "type": "Selector",
  81. "system": "task_a",
  82. "pattern": [{
  83. "type": "Sequence",
  84. "body": [{
  85. "type": "Behavior",
  86. "id": "send",
  87. "scope": {
  88. "min": 1,
  89. "max": 1
  90. }
  91. }],
  92. "scope": {
  93. "min": 1,
  94. "max": 1
  95. }
  96. }],
  97. "pre": null,
  98. "post": null
  99. }, {
  100. "type": "Selector",
  101. "system": "task_b",
  102. "pattern": [{
  103. "type": "Sequence",
  104. "body": [{
  105. "type": "Behavior",
  106. "id": "receive",
  107. "scope": {
  108. "min": 1,
  109. "max": 1
  110. }
  111. }],
  112. "scope": {
  113. "min": 1,
  114. "max": 1
  115. }
  116. }],
  117. "pre": null,
  118. "post": null
  119. }]
  120. }],
  121. "triggers": [],
  122. "init": [],
  123. "ast": [{
  124. "type": "System",
  125. "id": "task_a",
  126. "body": [{
  127. "type": "Sequence",
  128. "body": [{
  129. "type": "Behavior",
  130. "id": "send",
  131. "scope": {
  132. "min": 0,
  133. "max": null
  134. }
  135. }],
  136. "scope": {
  137. "min": 1,
  138. "max": 1
  139. }
  140. }],
  141. "refs": [
  142. "send"
  143. ],
  144. "properties": {},
  145. "scope": {
  146. "min": 1,
  147. "max": 1
  148. }
  149. }, {
  150. "type": "System",
  151. "id": "task_b",
  152. "body": [{
  153. "type": "Sequence",
  154. "body": [{
  155. "type": "Behavior",
  156. "id": "receive",
  157. "scope": {
  158. "min": 0,
  159. "max": null
  160. }
  161. }],
  162. "scope": {
  163. "min": 1,
  164. "max": 1
  165. }
  166. }],
  167. "refs": [
  168. "receive"
  169. ],
  170. "properties": {},
  171. "scope": {
  172. "min": 1,
  173. "max": 1
  174. }
  175. }, {
  176. "type": "Then",
  177. "body": [{
  178. "type": "Selector",
  179. "system": "task_a",
  180. "pattern": [{
  181. "type": "Sequence",
  182. "body": [{
  183. "type": "Behavior",
  184. "id": "send",
  185. "scope": {
  186. "min": 1,
  187. "max": 1
  188. }
  189. }],
  190. "scope": {
  191. "min": 1,
  192. "max": 1
  193. }
  194. }],
  195. "pre": null,
  196. "post": null
  197. }, {
  198. "type": "Selector",
  199. "system": "task_b",
  200. "pattern": [{
  201. "type": "Sequence",
  202. "body": [{
  203. "type": "Behavior",
  204. "id": "receive",
  205. "scope": {
  206. "min": 1,
  207. "max": 1
  208. }
  209. }],
  210. "scope": {
  211. "min": 1,
  212. "max": 1
  213. }
  214. }],
  215. "pre": null,
  216. "post": null
  217. }]
  218. }],
  219. "errors": []
  220. }
  221. },
  222. "kruskal": {
  223. "input": "SYSTEM: kruskal = make_set* find_edges* return;\nBEHAVIOR: find_edges = found_edge | found_no_edge;\nBEHAVIOR: found_edge = union_vertices add_edge_to_forest;\nWHEN: kruskal:make_set { count++ };\nWHEN: kruskal:find_edges { count--; if (count == 0) return false; };",
  224. "expected": {
  225. "systems": {
  226. "kruskal": {
  227. "type": "System",
  228. "id": "kruskal",
  229. "body": [{
  230. "type": "Sequence",
  231. "body": [{
  232. "type": "Behavior",
  233. "id": "make_set",
  234. "scope": {
  235. "min": 0,
  236. "max": null
  237. }
  238. }, {
  239. "type": "Behavior",
  240. "id": "find_edges",
  241. "scope": {
  242. "min": 0,
  243. "max": null
  244. }
  245. }, {
  246. "type": "Behavior",
  247. "id": "return",
  248. "scope": {
  249. "min": 1,
  250. "max": 1
  251. }
  252. }],
  253. "scope": {
  254. "min": 1,
  255. "max": 1
  256. }
  257. }],
  258. "refs": [
  259. "make_set",
  260. "find_edges",
  261. "return"
  262. ],
  263. "properties": {},
  264. "scope": {
  265. "min": 1,
  266. "max": 1
  267. }
  268. }
  269. },
  270. "behaviors": {
  271. "find_edges": {
  272. "type": "Behavior",
  273. "id": "find_edges",
  274. "body": [{
  275. "type": "Alternation",
  276. "body": [{
  277. "type": "Behavior",
  278. "id": "found_edge",
  279. "scope": {
  280. "min": 1,
  281. "max": 1
  282. }
  283. }, {
  284. "type": "Behavior",
  285. "id": "found_no_edge",
  286. "scope": {
  287. "min": 1,
  288. "max": 1
  289. }
  290. }],
  291. "scope": {
  292. "min": 1,
  293. "max": 1
  294. }
  295. }],
  296. "refs": [
  297. "found_edge",
  298. "found_no_edge"
  299. ],
  300. "properties": {}
  301. },
  302. "found_edge": {
  303. "type": "Behavior",
  304. "id": "found_edge",
  305. "body": [{
  306. "type": "Sequence",
  307. "body": [{
  308. "type": "Behavior",
  309. "id": "union_vertices",
  310. "scope": {
  311. "min": 1,
  312. "max": 1
  313. }
  314. }, {
  315. "type": "Behavior",
  316. "id": "add_edge_to_forest",
  317. "scope": {
  318. "min": 1,
  319. "max": 1
  320. }
  321. }],
  322. "scope": {
  323. "min": 1,
  324. "max": 1
  325. }
  326. }],
  327. "refs": [
  328. "union_vertices",
  329. "add_edge_to_forest"
  330. ],
  331. "properties": {}
  332. },
  333. "make_set": {
  334. "type": "Behavior",
  335. "id": "make_set",
  336. "body": [],
  337. "refs": [],
  338. "properties": {}
  339. },
  340. "return": {
  341. "type": "Behavior",
  342. "id": "return",
  343. "body": [],
  344. "refs": [],
  345. "properties": {}
  346. },
  347. "found_no_edge": {
  348. "type": "Behavior",
  349. "id": "found_no_edge",
  350. "body": [],
  351. "refs": [],
  352. "properties": {}
  353. },
  354. "union_vertices": {
  355. "type": "Behavior",
  356. "id": "union_vertices",
  357. "body": [],
  358. "refs": [],
  359. "properties": {}
  360. },
  361. "add_edge_to_forest": {
  362. "type": "Behavior",
  363. "id": "add_edge_to_forest",
  364. "body": [],
  365. "refs": [],
  366. "properties": {}
  367. }
  368. },
  369. "interactions": [],
  370. "triggers": [{
  371. "type": "Trigger",
  372. "on": {
  373. "type": "Selector",
  374. "system": "kruskal",
  375. "pattern": [{
  376. "type": "Sequence",
  377. "body": [{
  378. "type": "Behavior",
  379. "id": "make_set",
  380. "scope": {
  381. "min": 1,
  382. "max": 1
  383. }
  384. }],
  385. "scope": {
  386. "min": 1,
  387. "max": 1
  388. }
  389. }],
  390. "pre": null,
  391. "post": null
  392. },
  393. "do": "count++"
  394. }, {
  395. "type": "Trigger",
  396. "on": {
  397. "type": "Selector",
  398. "system": "kruskal",
  399. "pattern": [{
  400. "type": "Sequence",
  401. "body": [{
  402. "type": "Behavior",
  403. "id": "find_edges",
  404. "scope": {
  405. "min": 1,
  406. "max": 1
  407. }
  408. }],
  409. "scope": {
  410. "min": 1,
  411. "max": 1
  412. }
  413. }],
  414. "pre": null,
  415. "post": null
  416. },
  417. "do": "count--; if (count == 0) return false;"
  418. }],
  419. "init": [],
  420. "ast": [{
  421. "type": "System",
  422. "id": "kruskal",
  423. "body": [{
  424. "type": "Sequence",
  425. "body": [{
  426. "type": "Behavior",
  427. "id": "make_set",
  428. "scope": {
  429. "min": 0,
  430. "max": null
  431. }
  432. }, {
  433. "type": "Behavior",
  434. "id": "find_edges",
  435. "scope": {
  436. "min": 0,
  437. "max": null
  438. }
  439. }, {
  440. "type": "Behavior",
  441. "id": "return",
  442. "scope": {
  443. "min": 1,
  444. "max": 1
  445. }
  446. }],
  447. "scope": {
  448. "min": 1,
  449. "max": 1
  450. }
  451. }],
  452. "refs": [
  453. "make_set",
  454. "find_edges",
  455. "return"
  456. ],
  457. "properties": {},
  458. "scope": {
  459. "min": 1,
  460. "max": 1
  461. }
  462. }, {
  463. "type": "Behavior",
  464. "id": "find_edges",
  465. "body": [{
  466. "type": "Alternation",
  467. "body": [{
  468. "type": "Behavior",
  469. "id": "found_edge",
  470. "scope": {
  471. "min": 1,
  472. "max": 1
  473. }
  474. }, {
  475. "type": "Behavior",
  476. "id": "found_no_edge",
  477. "scope": {
  478. "min": 1,
  479. "max": 1
  480. }
  481. }],
  482. "scope": {
  483. "min": 1,
  484. "max": 1
  485. }
  486. }],
  487. "refs": [
  488. "found_edge",
  489. "found_no_edge"
  490. ],
  491. "properties": {}
  492. }, {
  493. "type": "Behavior",
  494. "id": "found_edge",
  495. "body": [{
  496. "type": "Sequence",
  497. "body": [{
  498. "type": "Behavior",
  499. "id": "union_vertices",
  500. "scope": {
  501. "min": 1,
  502. "max": 1
  503. }
  504. }, {
  505. "type": "Behavior",
  506. "id": "add_edge_to_forest",
  507. "scope": {
  508. "min": 1,
  509. "max": 1
  510. }
  511. }],
  512. "scope": {
  513. "min": 1,
  514. "max": 1
  515. }
  516. }],
  517. "refs": [
  518. "union_vertices",
  519. "add_edge_to_forest"
  520. ],
  521. "properties": {}
  522. }, {
  523. "type": "Trigger",
  524. "on": {
  525. "type": "Selector",
  526. "system": "kruskal",
  527. "pattern": [{
  528. "type": "Sequence",
  529. "body": [{
  530. "type": "Behavior",
  531. "id": "make_set",
  532. "scope": {
  533. "min": 1,
  534. "max": 1
  535. }
  536. }],
  537. "scope": {
  538. "min": 1,
  539. "max": 1
  540. }
  541. }],
  542. "pre": null,
  543. "post": null
  544. },
  545. "do": "count++"
  546. }, {
  547. "type": "Trigger",
  548. "on": {
  549. "type": "Selector",
  550. "system": "kruskal",
  551. "pattern": [{
  552. "type": "Sequence",
  553. "body": [{
  554. "type": "Behavior",
  555. "id": "find_edges",
  556. "scope": {
  557. "min": 1,
  558. "max": 1
  559. }
  560. }],
  561. "scope": {
  562. "min": 1,
  563. "max": 1
  564. }
  565. }],
  566. "pre": null,
  567. "post": null
  568. },
  569. "do": "count--; if (count == 0) return false;"
  570. }],
  571. "errors": []
  572. }
  573. }
  574. }