jssm 5.35.4 → 5.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/.codeclimate.yml +22 -22
  2. package/.editorconfig +12 -12
  3. package/.eslintrc +20 -20
  4. package/.nycrc +6 -6
  5. package/.travis.yml +8 -8
  6. package/LICENSE.md +21 -21
  7. package/README.md +997 -993
  8. package/dist/es6/jssm-dot.d.ts +6 -6
  9. package/dist/es6/jssm-dot.js +1 -1
  10. package/dist/es6/jssm.d.ts +100 -100
  11. package/dist/es6/jssm.js +792 -792
  12. package/dist/es6/jssm_types.d.ts +151 -151
  13. package/dist/es6/jssm_types.js +1 -1
  14. package/dist/es6/jssm_util.d.ts +8 -8
  15. package/dist/es6/jssm_util.js +34 -34
  16. package/dist/es6/version.d.ts +2 -2
  17. package/dist/es6/version.js +2 -2
  18. package/dist/jssm.es5.cjs.js +1 -1
  19. package/dist/jssm.es5.iife.js +1 -0
  20. package/jest-spec.config.js +27 -27
  21. package/jest-stoch.config.js +27 -27
  22. package/jssm-dot.d.ts +6 -6
  23. package/jssm.d.ts +100 -100
  24. package/jssm_types.d.ts +151 -151
  25. package/jssm_util.d.ts +8 -8
  26. package/package.json +125 -122
  27. package/rollup.config.iife.js +44 -44
  28. package/rollup.config.js +44 -44
  29. package/src/demo/index.html +38 -38
  30. package/src/demo/style.css +1 -1
  31. package/src/ts/jssm-dot.peg +928 -874
  32. package/src/ts/jssm.ts +1120 -1120
  33. package/src/ts/jssm_types.ts +346 -346
  34. package/src/ts/jssm_util.ts +100 -100
  35. package/src/ts/tests/actions.spec.ts +167 -167
  36. package/src/ts/tests/arrange.spec.ts +72 -72
  37. package/src/ts/tests/arrange.stoch.ts +4 -4
  38. package/src/ts/tests/array_box_if_string.spec.ts +30 -31
  39. package/src/ts/tests/array_transitions.spec.ts +129 -129
  40. package/src/ts/tests/arrow unicode.spec.ts +88 -88
  41. package/src/ts/tests/arrow.spec.ts +124 -124
  42. package/src/ts/tests/colors.spec.ts +58 -58
  43. package/src/ts/tests/comment.spec.ts +134 -134
  44. package/src/ts/tests/compile.spec.ts +79 -79
  45. package/src/ts/tests/constants.spec.ts +98 -98
  46. package/src/ts/tests/cycles.spec.ts +153 -153
  47. package/src/ts/tests/dot_preamble.spec.ts +16 -16
  48. package/src/ts/tests/embedded_sm.spec.ts +36 -36
  49. package/src/ts/tests/flow.spec.ts +22 -22
  50. package/src/ts/tests/forced transitions.spec.ts +26 -26
  51. package/src/ts/tests/general.spec.ts +933 -933
  52. package/src/ts/tests/graph node lists.spec.ts +21 -21
  53. package/src/ts/tests/histo.spec.ts +24 -24
  54. package/src/ts/tests/hooks.spec.ts +28 -0
  55. package/src/ts/tests/language.spec.ts +37 -37
  56. package/src/ts/tests/language_data/belarussian.json +13 -13
  57. package/src/ts/tests/language_data/bengali.json +15 -15
  58. package/src/ts/tests/language_data/emoji.json +21 -21
  59. package/src/ts/tests/language_data/english.json +16 -16
  60. package/src/ts/tests/language_data/french.json +16 -16
  61. package/src/ts/tests/language_data/german.json +16 -16
  62. package/src/ts/tests/language_data/hebrew.json +16 -16
  63. package/src/ts/tests/language_data/portuguese.json +12 -12
  64. package/src/ts/tests/language_data/russian.json +12 -12
  65. package/src/ts/tests/language_data/spanish.json +17 -17
  66. package/src/ts/tests/language_data/ukrainian.json +18 -18
  67. package/src/ts/tests/layout.spec.ts +29 -29
  68. package/src/ts/tests/machine_attributes.spec.ts +398 -398
  69. package/src/ts/tests/machine_name.spec.ts +14 -14
  70. package/src/ts/tests/named lists.spec.ts +24 -19
  71. package/src/ts/tests/nominated states.spec.ts +133 -133
  72. package/src/ts/tests/parse actions.spec.ts +32 -32
  73. package/src/ts/tests/parse.spec.ts +94 -94
  74. package/src/ts/tests/probability.spec.ts +146 -146
  75. package/src/ts/tests/r639.spec.ts +27 -27
  76. package/src/ts/tests/sample_select.spec.ts +173 -173
  77. package/src/ts/tests/seq.spec.ts +14 -16
  78. package/src/ts/tests/seq.stoch.ts +83 -0
  79. package/src/ts/tests/shapes.spec.ts +63 -63
  80. package/src/ts/tests/sm_tag.spec.ts +37 -37
  81. package/src/ts/tests/special characters.spec.ts +39 -39
  82. package/src/ts/tests/state_declaration.spec.ts +214 -200
  83. package/src/ts/tests/state_style.spec.ts +82 -39
  84. package/src/ts/tests/stop light.spec.ts +157 -157
  85. package/src/ts/tests/stripes.spec.ts +52 -52
  86. package/src/ts/tests/theme.spec.ts +45 -45
  87. package/src/ts/tests/weighted_histo_key.spec.ts +22 -22
  88. package/src/ts/tests/weighted_rand_select.spec.ts +27 -27
  89. package/src/ts/tests/weighted_sample_select.spec.ts +24 -26
  90. package/src/ts/version.ts +1 -1
  91. package/tree.txt +1794 -1794
  92. package/tsconfig.json +27 -27
  93. package/version.d.ts +2 -2
@@ -1,14 +1,14 @@
1
-
2
- import { sm } from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- describe('machine name', () => {
9
-
10
- test('doesn\'t throw', () =>
11
- expect( () => { const _foo = sm`machine_name: bob; a->b;`; }).not.toThrow()
12
- );
13
-
14
- });
1
+
2
+ import { sm } from '../jssm';
3
+
4
+
5
+
6
+
7
+
8
+ describe('machine name', () => {
9
+
10
+ test('doesn\'t throw', () =>
11
+ expect( () => { const _foo = sm`machine_name: bob; a->b;`; }).not.toThrow()
12
+ );
13
+
14
+ });
@@ -1,19 +1,24 @@
1
-
2
- import * as jssm from '../jssm';
3
-
4
-
5
-
6
-
7
-
8
- describe('named lists', () => {
9
-
10
- test('alone', () =>
11
- expect(() => { jssm.parse('&b: [a c e];'); }).not.toThrow() );
12
-
13
- test('before trans', () =>
14
- expect(() => { jssm.parse('&b: [a c e]; a->c;'); }).not.toThrow() );
15
-
16
- test('after trans', () =>
17
- expect(() => { jssm.parse('a->c; &b: [a c e];'); }).not.toThrow() );
18
-
19
- });
1
+
2
+ import * as jssm from '../jssm';
3
+
4
+
5
+
6
+
7
+
8
+ // TODO these tests only assert non-crashing
9
+ // That amn't very good, sah
10
+
11
+ test.todo('Assert better than non-crashing in named lists.spec.ts');
12
+
13
+ describe('named lists', () => {
14
+
15
+ test('alone', () =>
16
+ expect(() => { jssm.parse('&b: [a c e];'); }).not.toThrow() );
17
+
18
+ test('before trans', () =>
19
+ expect(() => { jssm.parse('&b: [a c e]; a->c;'); }).not.toThrow() );
20
+
21
+ test('after trans', () =>
22
+ expect(() => { jssm.parse('a->c; &b: [a c e];'); }).not.toThrow() );
23
+
24
+ });
@@ -1,133 +1,133 @@
1
-
2
- import * as jssm from '../jssm';
3
-
4
- const sm = jssm.sm,
5
- jp = jssm.parse;
6
-
7
-
8
-
9
-
10
-
11
- describe('simple naming', () => {
12
-
13
-
14
-
15
- describe('parse', () => {
16
-
17
- test('trans then node', () =>
18
- expect(() => {
19
- jp('a -> b; state a: { color: orange; };');
20
- }).not.toThrow() );
21
-
22
- test('node then trans', () =>
23
- expect(() => {
24
- jp('state a: { color: orange; }; a -> b;');
25
- }).not.toThrow() );
26
-
27
- test('cycle node named', () =>
28
- expect(() => {
29
- jp('[a b] -> +1; state a: { color: red; }; &b: [a c e];');
30
- }).not.toThrow() );
31
-
32
- test('two properties', () =>
33
- expect(() => {
34
- jp('a -> b; state a: { color: orange; shape: circle; };');
35
- }).not.toThrow() );
36
-
37
- });
38
-
39
-
40
-
41
- describe('sm tag', () => {
42
-
43
- test('trans then node', () =>
44
- expect(() => {
45
- sm`a -> b; state a: { color: orange; };`;
46
- }).not.toThrow() );
47
-
48
- test('node then trans', () =>
49
- expect(() => {
50
- sm`state a: { color: orange; }; a -> b;`;
51
- }).not.toThrow() );
52
-
53
- test.todo('Uncomment when named nodes work');
54
-
55
- // test('cycle node named', () =>
56
- // expect(() => {
57
- // sm`[a b] -> +1; state a: { color: red; }; &b: [a c e];`;
58
- // }).not.toThrow() );
59
-
60
- test('two properties', () =>
61
- expect(() => {
62
- sm`a -> b; state a: { color: orange; shape: circle; };`;
63
- }).not.toThrow() );
64
-
65
- });
66
-
67
- });
68
-
69
-
70
-
71
-
72
-
73
- describe('spacing variants', () => {
74
-
75
- test('tight', () =>
76
- expect(() => {
77
- jp('a -> b; state a:{color:orange;};');
78
- }).not.toThrow() );
79
-
80
- test('framed', () =>
81
- expect(() => {
82
- jp('a -> b; state a:{ color:orange; };');
83
- }).not.toThrow() );
84
-
85
- test('sentence', () =>
86
- expect(() => {
87
- jp('a -> b; state a:{ color: orange; };');
88
- }).not.toThrow() );
89
-
90
- test('fully', () =>
91
- expect(() => {
92
- jp('a -> b; state a:{ color : orange; };');
93
- }).not.toThrow() );
94
-
95
- test('mars', () =>
96
- expect(() => {
97
- jp('a -> b; state a:{color : orange;};');
98
- }).not.toThrow() );
99
-
100
- });
101
-
102
-
103
-
104
-
105
-
106
- describe('properties', () => {
107
-
108
- test('color', () =>
109
-
110
- expect(
111
- sm`a -> b; state a:{color:orange;};`.raw_state_declarations()[0]
112
- ).toEqual(
113
- {state:'a', color:'#ffa500ff', declarations:[{key: "color", value: "#ffa500ff"}]}
114
- )
115
-
116
- );
117
-
118
- });
119
-
120
-
121
-
122
-
123
-
124
- test.todo('More to do in nominated states');
125
-
126
-
127
-
128
-
129
-
130
- // TODO FIXME TESTME test state_delarations/0
131
- // TODO FIXME TESTME test state_delaration/1 for has
132
- // TODO FIXME TESTME test state_delaration/1 for doesn't have
133
- // TODO FIXME TESTME test that redeclaring a state throws
1
+
2
+ import * as jssm from '../jssm';
3
+
4
+ const sm = jssm.sm,
5
+ jp = jssm.parse;
6
+
7
+
8
+
9
+
10
+
11
+ describe('simple naming', () => {
12
+
13
+
14
+
15
+ describe('parse', () => {
16
+
17
+ test('trans then node', () =>
18
+ expect(() => {
19
+ jp('a -> b; state a: { color: orange; };');
20
+ }).not.toThrow() );
21
+
22
+ test('node then trans', () =>
23
+ expect(() => {
24
+ jp('state a: { color: orange; }; a -> b;');
25
+ }).not.toThrow() );
26
+
27
+ test('cycle node named', () =>
28
+ expect(() => {
29
+ jp('[a b] -> +1; state a: { color: red; }; &b: [a c e];');
30
+ }).not.toThrow() );
31
+
32
+ test('two properties', () =>
33
+ expect(() => {
34
+ jp('a -> b; state a: { color: orange; shape: circle; };');
35
+ }).not.toThrow() );
36
+
37
+ });
38
+
39
+
40
+
41
+ describe('sm tag', () => {
42
+
43
+ test('trans then node', () =>
44
+ expect(() => {
45
+ sm`a -> b; state a: { color: orange; };`;
46
+ }).not.toThrow() );
47
+
48
+ test('node then trans', () =>
49
+ expect(() => {
50
+ sm`state a: { color: orange; }; a -> b;`;
51
+ }).not.toThrow() );
52
+
53
+ test.todo('Uncomment when named nodes work');
54
+
55
+ // test('cycle node named', () =>
56
+ // expect(() => {
57
+ // sm`[a b] -> +1; state a: { color: red; }; &b: [a c e];`;
58
+ // }).not.toThrow() );
59
+
60
+ test('two properties', () =>
61
+ expect(() => {
62
+ sm`a -> b; state a: { color: orange; shape: circle; };`;
63
+ }).not.toThrow() );
64
+
65
+ });
66
+
67
+ });
68
+
69
+
70
+
71
+
72
+
73
+ describe('spacing variants', () => {
74
+
75
+ test('tight', () =>
76
+ expect(() => {
77
+ jp('a -> b; state a:{color:orange;};');
78
+ }).not.toThrow() );
79
+
80
+ test('framed', () =>
81
+ expect(() => {
82
+ jp('a -> b; state a:{ color:orange; };');
83
+ }).not.toThrow() );
84
+
85
+ test('sentence', () =>
86
+ expect(() => {
87
+ jp('a -> b; state a:{ color: orange; };');
88
+ }).not.toThrow() );
89
+
90
+ test('fully', () =>
91
+ expect(() => {
92
+ jp('a -> b; state a:{ color : orange; };');
93
+ }).not.toThrow() );
94
+
95
+ test('mars', () =>
96
+ expect(() => {
97
+ jp('a -> b; state a:{color : orange;};');
98
+ }).not.toThrow() );
99
+
100
+ });
101
+
102
+
103
+
104
+
105
+
106
+ describe('properties', () => {
107
+
108
+ test('color', () =>
109
+
110
+ expect(
111
+ sm`a -> b; state a:{color:orange;};`.raw_state_declarations()[0]
112
+ ).toEqual(
113
+ {state:'a', color:'#ffa500ff', declarations:[{key: "color", value: "#ffa500ff"}]}
114
+ )
115
+
116
+ );
117
+
118
+ });
119
+
120
+
121
+
122
+
123
+
124
+ test.todo('More to do in nominated states');
125
+
126
+
127
+
128
+
129
+
130
+ // TODO FIXME TESTME test state_delarations/0
131
+ // TODO FIXME TESTME test state_delaration/1 for has
132
+ // TODO FIXME TESTME test state_delaration/1 for doesn't have
133
+ // TODO FIXME TESTME test that redeclaring a state throws
@@ -1,32 +1,32 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import { sm } from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('matter', () => {
11
-
12
- const matter = sm` Solid 'Heat' <-> 'Cool' Liquid 'Heat' <-> 'Cool' Gas 'Heat' <-> 'Cool' Plasma; `;
13
-
14
- test( 'starts Solid', () => expect(matter.state() ).toBe( 'Solid' ) );
15
- test( 'Heat is true', () => expect(matter.action('Heat') ).toBe( true ) );
16
- test( 'is now Liquid', () => expect(matter.state() ).toBe( 'Liquid' ) );
17
- test( 'Heat is true 2', () => expect(matter.action('Heat') ).toBe( true ) );
18
- test( 'is now Gas', () => expect(matter.state() ).toBe( 'Gas' ) );
19
- test( 'Heat is true 3', () => expect(matter.action('Heat') ).toBe( true ) );
20
- test( 'is now Plasma', () => expect(matter.state() ).toBe( 'Plasma' ) );
21
- test( 'Heat is false', () => expect(matter.action('Heat') ).toBe( false ) );
22
- test( 'is now Plasma 2', () => expect(matter.state() ).toBe( 'Plasma' ) );
23
- test( 'Cool is true', () => expect(matter.action('Cool') ).toBe( true ) );
24
- test( 'is now Gas 2', () => expect(matter.state() ).toBe( 'Gas' ) );
25
- test( 'Cool is true 2', () => expect(matter.action('Cool') ).toBe( true ) );
26
- test( 'is now Liquid 2', () => expect(matter.state() ).toBe( 'Liquid' ) );
27
- test( 'Cool is true 3', () => expect(matter.action('Cool') ).toBe( true ) );
28
- test( 'is now Solid', () => expect(matter.state() ).toBe( 'Solid' ) );
29
- test( 'Cool is false', () => expect(matter.action('Cool') ).toBe( false ) );
30
- test( 'is now Solid 2', () => expect(matter.state() ).toBe( 'Solid' ) );
31
-
32
- });
1
+
2
+ /* eslint-disable max-len */
3
+
4
+ import { sm } from '../jssm';
5
+
6
+
7
+
8
+
9
+
10
+ describe('matter', () => {
11
+
12
+ const matter = sm` Solid 'Heat' <-> 'Cool' Liquid 'Heat' <-> 'Cool' Gas 'Heat' <-> 'Cool' Plasma; `;
13
+
14
+ test( 'starts Solid', () => expect(matter.state() ).toBe( 'Solid' ) );
15
+ test( 'Heat is true', () => expect(matter.action('Heat') ).toBe( true ) );
16
+ test( 'is now Liquid', () => expect(matter.state() ).toBe( 'Liquid' ) );
17
+ test( 'Heat is true 2', () => expect(matter.action('Heat') ).toBe( true ) );
18
+ test( 'is now Gas', () => expect(matter.state() ).toBe( 'Gas' ) );
19
+ test( 'Heat is true 3', () => expect(matter.action('Heat') ).toBe( true ) );
20
+ test( 'is now Plasma', () => expect(matter.state() ).toBe( 'Plasma' ) );
21
+ test( 'Heat is false', () => expect(matter.action('Heat') ).toBe( false ) );
22
+ test( 'is now Plasma 2', () => expect(matter.state() ).toBe( 'Plasma' ) );
23
+ test( 'Cool is true', () => expect(matter.action('Cool') ).toBe( true ) );
24
+ test( 'is now Gas 2', () => expect(matter.state() ).toBe( 'Gas' ) );
25
+ test( 'Cool is true 2', () => expect(matter.action('Cool') ).toBe( true ) );
26
+ test( 'is now Liquid 2', () => expect(matter.state() ).toBe( 'Liquid' ) );
27
+ test( 'Cool is true 3', () => expect(matter.action('Cool') ).toBe( true ) );
28
+ test( 'is now Solid', () => expect(matter.state() ).toBe( 'Solid' ) );
29
+ test( 'Cool is false', () => expect(matter.action('Cool') ).toBe( false ) );
30
+ test( 'is now Solid 2', () => expect(matter.state() ).toBe( 'Solid' ) );
31
+
32
+ });
@@ -1,94 +1,94 @@
1
-
2
- /* eslint-disable max-len */
3
-
4
- import * as jssm from '../jssm';
5
-
6
-
7
-
8
-
9
-
10
- describe('parse/1', () => {
11
-
12
- describe('forward arrow', () => {
13
-
14
- const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
15
- AdB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","l_desc": [{"key":"arc_label","value":"d"}]}}],
16
- ABd = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","r_desc": [{"key":"arc_label","value":"d"}]}}],
17
- AdBd = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","l_desc": [{"key":"arc_label","value":"d"}],"r_desc": [{"key":"arc_label","value":"f"}]}}];
18
-
19
- const echo_equal = (testt, validator) =>
20
- test(testt, () =>
21
- expect(jssm.parse(testt))
22
- .toEqual(validator) );
23
-
24
- const ShouldEqualAtoB = ['a->b;', 'a ->b;', 'a-> b;', 'a -> b;', 'a{}->b;', 'a->{}b;', 'a{}->{}b;'];
25
- ShouldEqualAtoB.map(p => echo_equal(p, AtoB));
26
-
27
- echo_equal('a{arc_label:d;}->b;', AdB);
28
- echo_equal('a{arc_label:"d";}->b;', AdB);
29
- echo_equal('a->{arc_label:d;}b;', ABd);
30
- echo_equal('a{arc_label:d;}->{arc_label:f;}b;', AdBd);
31
-
32
- });
33
-
34
- describe('double arrow', () => {
35
-
36
- const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b"}}],
37
- AdB = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","l_desc": [{"key":"arc_label","value":"d"}]}}],
38
- ABd = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","r_desc": [{"key":"arc_label","value":"d"}]}}],
39
- AdBd = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","l_desc": [{"key":"arc_label","value":"d"}],"r_desc": [{"key":"arc_label","value":"f"}]}}];
40
-
41
- const echo_equal = (testt, validator) =>
42
- test(testt, () =>
43
- expect(jssm.parse(testt))
44
- .toEqual(validator) );
45
-
46
- const ShouldEqualAtoB = ['a<->b;', 'a <->b;', 'a<-> b;', 'a <-> b;', 'a{}<->b;', 'a<->{}b;', 'a{}<->{}b;'];
47
- ShouldEqualAtoB.map(p => echo_equal(p, AtoB));
48
-
49
- echo_equal('a{arc_label:d;}<->b;', AdB);
50
- echo_equal('a{arc_label:"d";}<->b;', AdB);
51
- echo_equal('a<->{arc_label:d;}b;', ABd);
52
- echo_equal('a{arc_label:d;}<->{arc_label:f;}b;', AdBd);
53
-
54
- });
55
-
56
- describe('chain', () => {
57
- const AtoBtoC = [{"key":"transition","from":"a","se":{"kind":"->","to":"b","se":{"kind":"->","to":"c"}}}];
58
- test('a->b->c;', () =>
59
- expect( jssm.parse('a->b->c;') )
60
- .toEqual(AtoBtoC) );
61
- });
62
-
63
- describe('sequence', () => {
64
- const AtoB_CtoD = [{"key":"transition","from":"a","se":{"kind":"->","to":"b"}},{"key":"transition","from":"c","se":{"kind":"->","to":"d"}}];
65
- test('a->b;c->d;', () =>
66
- expect( jssm.parse('a->b;c->d;') )
67
- .toEqual(AtoB_CtoD) );
68
- });
69
-
70
- test.todo('graph inputs, graph outputs in parse.spec');
71
-
72
- // todo: graph: {inputs: [foo]}
73
- // todo: graph: {outputs: [foo]}
74
-
75
- test.todo('improve torture in parse.spec');
76
-
77
- describe('torture', () => {
78
-
79
- const augh = `
80
- a->b-> c-> d -> e
81
- ->
82
- f <- g <= h <-> i <=> j ~> k <~ l <~> m <~-> n <-~> o <=~> p <~=> q <-=> r <=-> s 'A' <= 'B' t;
83
-
84
- a ← b2 ⇐ c2 ↚ d2 → e2 ⇒ f2 ↛ g2 ↔ h2 ⇔ i2 ↮ j2 ←⇒ k2 ⇐→ l2 ←↛ m2 ↚→ n2 ⇐↛ o2 ↚⇒ p2;
85
-
86
- `;
87
-
88
- test('doesn\'t throw', () => expect(() => { jssm.parse(augh); }).not.toThrow() );
89
-
90
- });
91
-
92
- });
93
-
94
- // stochable
1
+
2
+ /* eslint-disable max-len */
3
+
4
+ import * as jssm from '../jssm';
5
+
6
+
7
+
8
+
9
+
10
+ describe('parse/1', () => {
11
+
12
+ describe('forward arrow', () => {
13
+
14
+ const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b"}}],
15
+ AdB = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","l_desc": [{"key":"arc_label","value":"d"}]}}],
16
+ ABd = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","r_desc": [{"key":"arc_label","value":"d"}]}}],
17
+ AdBd = [{"key": "transition", "from": "a", "se": {"kind": "->","to": "b","l_desc": [{"key":"arc_label","value":"d"}],"r_desc": [{"key":"arc_label","value":"f"}]}}];
18
+
19
+ const echo_equal = (testt, validator) =>
20
+ test(testt, () =>
21
+ expect(jssm.parse(testt))
22
+ .toEqual(validator) );
23
+
24
+ const ShouldEqualAtoB = ['a->b;', 'a ->b;', 'a-> b;', 'a -> b;', 'a{}->b;', 'a->{}b;', 'a{}->{}b;'];
25
+ ShouldEqualAtoB.map(p => echo_equal(p, AtoB));
26
+
27
+ echo_equal('a{arc_label:d;}->b;', AdB);
28
+ echo_equal('a{arc_label:"d";}->b;', AdB);
29
+ echo_equal('a->{arc_label:d;}b;', ABd);
30
+ echo_equal('a{arc_label:d;}->{arc_label:f;}b;', AdBd);
31
+
32
+ });
33
+
34
+ describe('double arrow', () => {
35
+
36
+ const AtoB = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b"}}],
37
+ AdB = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","l_desc": [{"key":"arc_label","value":"d"}]}}],
38
+ ABd = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","r_desc": [{"key":"arc_label","value":"d"}]}}],
39
+ AdBd = [{"key": "transition", "from": "a", "se": {"kind": "<->","to": "b","l_desc": [{"key":"arc_label","value":"d"}],"r_desc": [{"key":"arc_label","value":"f"}]}}];
40
+
41
+ const echo_equal = (testt, validator) =>
42
+ test(testt, () =>
43
+ expect(jssm.parse(testt))
44
+ .toEqual(validator) );
45
+
46
+ const ShouldEqualAtoB = ['a<->b;', 'a <->b;', 'a<-> b;', 'a <-> b;', 'a{}<->b;', 'a<->{}b;', 'a{}<->{}b;'];
47
+ ShouldEqualAtoB.map(p => echo_equal(p, AtoB));
48
+
49
+ echo_equal('a{arc_label:d;}<->b;', AdB);
50
+ echo_equal('a{arc_label:"d";}<->b;', AdB);
51
+ echo_equal('a<->{arc_label:d;}b;', ABd);
52
+ echo_equal('a{arc_label:d;}<->{arc_label:f;}b;', AdBd);
53
+
54
+ });
55
+
56
+ describe('chain', () => {
57
+ const AtoBtoC = [{"key":"transition","from":"a","se":{"kind":"->","to":"b","se":{"kind":"->","to":"c"}}}];
58
+ test('a->b->c;', () =>
59
+ expect( jssm.parse('a->b->c;') )
60
+ .toEqual(AtoBtoC) );
61
+ });
62
+
63
+ describe('sequence', () => {
64
+ const AtoB_CtoD = [{"key":"transition","from":"a","se":{"kind":"->","to":"b"}},{"key":"transition","from":"c","se":{"kind":"->","to":"d"}}];
65
+ test('a->b;c->d;', () =>
66
+ expect( jssm.parse('a->b;c->d;') )
67
+ .toEqual(AtoB_CtoD) );
68
+ });
69
+
70
+ test.todo('graph inputs, graph outputs in parse.spec');
71
+
72
+ // todo: graph: {inputs: [foo]}
73
+ // todo: graph: {outputs: [foo]}
74
+
75
+ test.todo('improve torture in parse.spec');
76
+
77
+ describe('torture', () => {
78
+
79
+ const augh = `
80
+ a->b-> c-> d -> e
81
+ ->
82
+ f <- g <= h <-> i <=> j ~> k <~ l <~> m <~-> n <-~> o <=~> p <~=> q <-=> r <=-> s 'A' <= 'B' t;
83
+
84
+ a ← b2 ⇐ c2 ↚ d2 → e2 ⇒ f2 ↛ g2 ↔ h2 ⇔ i2 ↮ j2 ←⇒ k2 ⇐→ l2 ←↛ m2 ↚→ n2 ⇐↛ o2 ↚⇒ p2;
85
+
86
+ `;
87
+
88
+ test('doesn\'t throw', () => expect(() => { jssm.parse(augh); }).not.toThrow() );
89
+
90
+ });
91
+
92
+ });
93
+
94
+ // stochable