jssm 5.44.0 → 5.46.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.
- package/dist/es6/jssm.d.ts +6 -1
- package/dist/es6/jssm.js +104 -14
- package/dist/es6/jssm_types.d.ts +26 -1
- package/dist/es6/jssm_util.d.ts +3 -1
- package/dist/es6/jssm_util.js +3 -1
- package/dist/es6/version.js +1 -1
- package/dist/jssm.es5.cjs.js +1 -1
- package/jssm.d.ts +6 -1
- package/jssm_types.d.ts +26 -1
- package/jssm_util.d.ts +3 -1
- package/package.json +2 -3
- package/.codeclimate.yml +0 -22
- package/.editorconfig +0 -12
- package/.eslintrc +0 -20
- package/.nycrc +0 -6
- package/.travis.yml +0 -9
- package/dist/jssm.es5.iife.js +0 -1
- package/jest-spec.config.js +0 -27
- package/jest-stoch.config.js +0 -27
- package/rollup.config.iife.js +0 -44
- package/rollup.config.js +0 -44
- package/src/demo/index.html +0 -38
- package/src/demo/style.css +0 -2
- package/src/ts/jssm-dot.peg +0 -928
- package/src/ts/jssm.ts +0 -1120
- package/src/ts/jssm_types.ts +0 -346
- package/src/ts/jssm_util.ts +0 -100
- package/src/ts/tests/actions.spec.ts +0 -167
- package/src/ts/tests/arrange.spec.ts +0 -72
- package/src/ts/tests/arrange.stoch.ts +0 -4
- package/src/ts/tests/array_box_if_string.spec.ts +0 -30
- package/src/ts/tests/array_transitions.spec.ts +0 -129
- package/src/ts/tests/arrow unicode.spec.ts +0 -88
- package/src/ts/tests/arrow.spec.ts +0 -124
- package/src/ts/tests/colors.spec.ts +0 -58
- package/src/ts/tests/comment.spec.ts +0 -134
- package/src/ts/tests/compile.spec.ts +0 -79
- package/src/ts/tests/constants.spec.ts +0 -98
- package/src/ts/tests/cycles.spec.ts +0 -153
- package/src/ts/tests/dot_preamble.spec.ts +0 -16
- package/src/ts/tests/embedded_sm.spec.ts +0 -36
- package/src/ts/tests/flow.spec.ts +0 -22
- package/src/ts/tests/forced transitions.spec.ts +0 -26
- package/src/ts/tests/general.spec.ts +0 -933
- package/src/ts/tests/graph node lists.spec.ts +0 -21
- package/src/ts/tests/histo.spec.ts +0 -24
- package/src/ts/tests/hooks.spec.ts +0 -28
- package/src/ts/tests/language.spec.ts +0 -37
- package/src/ts/tests/language_data/belarussian.json +0 -14
- package/src/ts/tests/language_data/bengali.json +0 -16
- package/src/ts/tests/language_data/emoji.json +0 -22
- package/src/ts/tests/language_data/english.json +0 -17
- package/src/ts/tests/language_data/french.json +0 -17
- package/src/ts/tests/language_data/german.json +0 -17
- package/src/ts/tests/language_data/hebrew.json +0 -16
- package/src/ts/tests/language_data/portuguese.json +0 -13
- package/src/ts/tests/language_data/russian.json +0 -13
- package/src/ts/tests/language_data/spanish.json +0 -17
- package/src/ts/tests/language_data/ukrainian.json +0 -19
- package/src/ts/tests/layout.spec.ts +0 -29
- package/src/ts/tests/machine_attributes.spec.ts +0 -398
- package/src/ts/tests/machine_name.spec.ts +0 -14
- package/src/ts/tests/named lists.spec.ts +0 -24
- package/src/ts/tests/nominated states.spec.ts +0 -133
- package/src/ts/tests/parse actions.spec.ts +0 -32
- package/src/ts/tests/parse.spec.ts +0 -94
- package/src/ts/tests/probability.spec.ts +0 -146
- package/src/ts/tests/r639.spec.ts +0 -27
- package/src/ts/tests/sample_select.spec.ts +0 -173
- package/src/ts/tests/seq.spec.ts +0 -14
- package/src/ts/tests/seq.stoch.ts +0 -83
- package/src/ts/tests/shapes.spec.ts +0 -63
- package/src/ts/tests/sm_tag.spec.ts +0 -37
- package/src/ts/tests/special characters.spec.ts +0 -39
- package/src/ts/tests/state_declaration.spec.ts +0 -214
- package/src/ts/tests/state_style.spec.ts +0 -82
- package/src/ts/tests/stop light.spec.ts +0 -157
- package/src/ts/tests/stripes.spec.ts +0 -52
- package/src/ts/tests/theme.spec.ts +0 -45
- package/src/ts/tests/weighted_histo_key.spec.ts +0 -22
- package/src/ts/tests/weighted_rand_select.spec.ts +0 -27
- package/src/ts/tests/weighted_sample_select.spec.ts +0 -24
- package/src/ts/version.ts +0 -3
- package/tree.txt +0 -1794
- package/tsconfig.json +0 -27
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { sm } from '../jssm';
|
|
3
|
-
|
|
4
|
-
const r639 = require('reduce-to-639-1').reduce;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
test.todo('Most of this machine_attributes stuff should be rewritten as table-driven and/or stoch');
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
describe('machine_name', () => {
|
|
17
|
-
|
|
18
|
-
test('atom', () =>
|
|
19
|
-
expect(() => { const _foo = sm`machine_name: bob; a->b;`; })
|
|
20
|
-
.not.toThrow() );
|
|
21
|
-
|
|
22
|
-
test('quoted string', () =>
|
|
23
|
-
expect(() => { const _foo = sm`machine_name: "bo b"; a->b;`; })
|
|
24
|
-
.not.toThrow() );
|
|
25
|
-
|
|
26
|
-
test('retval correct', () =>
|
|
27
|
-
expect(sm`machine_name: testval; a->b;`.machine_name() )
|
|
28
|
-
.toBe('testval') );
|
|
29
|
-
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
describe('machine_language', () => {
|
|
37
|
-
|
|
38
|
-
const eachTest = (name, lang) => {
|
|
39
|
-
|
|
40
|
-
test(`${name} machine_language with transclusion is correct for sm\`machine_language: ${lang}; a->b;\``, () =>
|
|
41
|
-
expect( ((sm`machine_language: ${lang}; a->b;`).machine_language()) )
|
|
42
|
-
.toBe( r639(lang) ) );
|
|
43
|
-
|
|
44
|
-
test.todo('machine_attributes spec more available');
|
|
45
|
-
|
|
46
|
-
// test(`${name} machine_language with transclusion is correct for sm\`machine_language: "${lang}"; a->b;\``, () =>
|
|
47
|
-
// t.is(r639(lang), ((sm`machine_language: "${lang}"; a->b;`).machine_language()) ) );
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
test(`Eng hand-written is correct without quotes`, () =>
|
|
52
|
-
expect(((sm`machine_language: EnGlIsH; a->b;`).machine_language() ))
|
|
53
|
-
.toBe('en') );
|
|
54
|
-
|
|
55
|
-
test(`Eng hand-written is correct with quotes`, () =>
|
|
56
|
-
expect(((sm`machine_language: "EnGlIsH"; a->b;`).machine_language() ))
|
|
57
|
-
.toBe('en') );
|
|
58
|
-
|
|
59
|
-
test(`Amharic hand-written is correct without quotes`, () =>
|
|
60
|
-
expect(((sm`machine_language: አማርኛ; a->b;`).machine_language() ))
|
|
61
|
-
.toBe('am') );
|
|
62
|
-
|
|
63
|
-
test.todo('machine_attributes spec more available 2');
|
|
64
|
-
|
|
65
|
-
// test(`Amharic hand-written is correct with quotes`, () =>
|
|
66
|
-
// t.is('am', ((sm`machine_language: "አማርኛ"; a->b;`).machine_language()) ) );
|
|
67
|
-
|
|
68
|
-
eachTest('atom correct case', 'English');
|
|
69
|
-
eachTest('atom lowercase', 'english');
|
|
70
|
-
eachTest('atom mixedcase', 'eNGliSH');
|
|
71
|
-
eachTest('amharic', 'አማርኛ');
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
describe('machine_author', () => {
|
|
80
|
-
|
|
81
|
-
test('single atom', () =>
|
|
82
|
-
expect( () => { const _foo = sm`machine_author: bob; a->b;`; })
|
|
83
|
-
.not.toThrow() );
|
|
84
|
-
|
|
85
|
-
test('single quoted string', () =>
|
|
86
|
-
expect( () => { const _foo = sm`machine_author: "bo b"; a->b;`; })
|
|
87
|
-
.not.toThrow() );
|
|
88
|
-
|
|
89
|
-
test('atom list', () =>
|
|
90
|
-
expect( () => { const _foo = sm`machine_author: [bob dobbs]; a->b;`; })
|
|
91
|
-
.not.toThrow() );
|
|
92
|
-
|
|
93
|
-
test('quoted string list', () =>
|
|
94
|
-
expect( () => { const _foo = sm`machine_author: ["bo b" "do bbs"]; a->b;`; })
|
|
95
|
-
.not.toThrow() );
|
|
96
|
-
|
|
97
|
-
test('mixed list a/q', () =>
|
|
98
|
-
expect( () => { const _foo = sm`machine_author: [bob "do bbs"]; a->b;`; })
|
|
99
|
-
.not.toThrow() );
|
|
100
|
-
|
|
101
|
-
test('mixed list q/a', () =>
|
|
102
|
-
expect( () => { const _foo = sm`machine_author: ["bo b" dobbs]; a->b;`; })
|
|
103
|
-
.not.toThrow() );
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
test('single retval', () =>
|
|
107
|
-
expect(sm`machine_author: testval; a->b;`.machine_author() )
|
|
108
|
-
.toEqual(['testval']) );
|
|
109
|
-
|
|
110
|
-
test('multiple retval', () =>
|
|
111
|
-
expect(sm`machine_author: [bob david]; a->b;`.machine_author() )
|
|
112
|
-
.toEqual(['bob','david']) );
|
|
113
|
-
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
describe('machine_contributor', () => {
|
|
121
|
-
|
|
122
|
-
test('atom', () =>
|
|
123
|
-
expect( () => { const _ = sm`machine_contributor: bob; a->b;`; })
|
|
124
|
-
.not.toThrow() );
|
|
125
|
-
|
|
126
|
-
test('quoted string', () =>
|
|
127
|
-
expect( () => { const _ = sm`machine_contributor: "bo b"; a->b;`; })
|
|
128
|
-
.not.toThrow() );
|
|
129
|
-
|
|
130
|
-
test('atom list', () =>
|
|
131
|
-
expect( () => { const _ = sm`machine_contributor: [bob dobbs]; a->b;`; })
|
|
132
|
-
.not.toThrow() );
|
|
133
|
-
|
|
134
|
-
test('quoted string list', () =>
|
|
135
|
-
expect( () => { const _ = sm`machine_contributor: ["bo b" "do bbs"]; a->b;`; })
|
|
136
|
-
.not.toThrow() );
|
|
137
|
-
|
|
138
|
-
test('mixed list a/q', () =>
|
|
139
|
-
expect( () => { const _ = sm`machine_contributor: [bob "do bbs"]; a->b;`; })
|
|
140
|
-
.not.toThrow() );
|
|
141
|
-
|
|
142
|
-
test('mixed list q/a', () =>
|
|
143
|
-
expect( () => { const _ = sm`machine_contributor: ["bo b" dobbs]; a->b;`; })
|
|
144
|
-
.not.toThrow() );
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
test('single retval', () =>
|
|
148
|
-
expect(sm`machine_contributor: testval; a->b;`.machine_contributor() )
|
|
149
|
-
.toEqual(["testval"]) );
|
|
150
|
-
|
|
151
|
-
test('multiple retval', () =>
|
|
152
|
-
expect(sm`machine_contributor: [bob david]; a->b;`.machine_contributor() )
|
|
153
|
-
.toEqual(['bob','david']) );
|
|
154
|
-
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
describe('machine_comment', () => {
|
|
162
|
-
|
|
163
|
-
test('atom', () =>
|
|
164
|
-
expect( () => { const _foo = sm`machine_comment: bob; a->b;`; })
|
|
165
|
-
.not.toThrow() );
|
|
166
|
-
|
|
167
|
-
test('quoted string', () =>
|
|
168
|
-
expect( () => { const _foo = sm`machine_comment: "bo b"; a->b;`; })
|
|
169
|
-
.not.toThrow() );
|
|
170
|
-
|
|
171
|
-
test('retval correct', () =>
|
|
172
|
-
expect(sm`machine_comment: testval; a->b;`.machine_comment() )
|
|
173
|
-
.toBe("testval") );
|
|
174
|
-
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
describe('machine_definition', () => {
|
|
182
|
-
|
|
183
|
-
test('url', () =>
|
|
184
|
-
expect( () => { const _foo = sm`machine_definition: http://google.com/ ; a->b;`; })
|
|
185
|
-
.not.toThrow() );
|
|
186
|
-
|
|
187
|
-
test('url botched', () =>
|
|
188
|
-
expect( () => { const _foo = sm`machine_definition: "not a url"; a->b;`; })
|
|
189
|
-
.toThrow() );
|
|
190
|
-
|
|
191
|
-
test('retval correct', () =>
|
|
192
|
-
expect(sm`machine_definition: http://google.com/ ; a->b;`.machine_definition() )
|
|
193
|
-
.toBe("http://google.com/") );
|
|
194
|
-
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
describe('machine_version', () => {
|
|
202
|
-
|
|
203
|
-
test('semver 0.0.0', () =>
|
|
204
|
-
expect( () => { const _f = sm`machine_version: 0.0.0; a->b;`; })
|
|
205
|
-
.not.toThrow() );
|
|
206
|
-
|
|
207
|
-
test('semver 0.0.1', () =>
|
|
208
|
-
expect( () => { const _f = sm`machine_version: 0.0.1; a->b;`; })
|
|
209
|
-
.not.toThrow() );
|
|
210
|
-
|
|
211
|
-
test('semver 0.1.0', () =>
|
|
212
|
-
expect( () => { const _f = sm`machine_version: 0.1.0; a->b;`; })
|
|
213
|
-
.not.toThrow() );
|
|
214
|
-
|
|
215
|
-
test('semver 1.0.0', () =>
|
|
216
|
-
expect( () => { const _f = sm`machine_version: 1.0.0; a->b;`; })
|
|
217
|
-
.not.toThrow() );
|
|
218
|
-
|
|
219
|
-
test('semver 1.0.1', () =>
|
|
220
|
-
expect( () => { const _f = sm`machine_version: 1.0.1; a->b;`; })
|
|
221
|
-
.not.toThrow() );
|
|
222
|
-
|
|
223
|
-
test('semver 1.1.1', () =>
|
|
224
|
-
expect( () => { const _f = sm`machine_version: 1.1.1; a->b;`; })
|
|
225
|
-
.not.toThrow() );
|
|
226
|
-
|
|
227
|
-
test('semver 2.0.0', () =>
|
|
228
|
-
expect( () => { const _f = sm`machine_version: 2.0.0; a->b;`; })
|
|
229
|
-
.not.toThrow() );
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
test('semver notAS', () =>
|
|
233
|
-
expect(() => { const _f = sm`machine_version: "Not a semver"; a->b;`; })
|
|
234
|
-
.toThrow() );
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
test('retval correct', () =>
|
|
238
|
-
expect(sm`machine_version: 0.0.0; a->b;`.machine_version())
|
|
239
|
-
.toEqual({full:"0.0.0", major:0, minor:0, patch:0}) );
|
|
240
|
-
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
describe('machine_license', () => {
|
|
248
|
-
|
|
249
|
-
test('retval correct', () =>
|
|
250
|
-
expect( sm`machine_license: testval; a->b;`.machine_license() )
|
|
251
|
-
.toBe("testval") );
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
describe('near', () => {
|
|
255
|
-
|
|
256
|
-
test('Public domain', () =>
|
|
257
|
-
expect( () => { const _ = sm`machine_license:Public domain; a->b;`; })
|
|
258
|
-
.not.toThrow() );
|
|
259
|
-
|
|
260
|
-
test('MIT', () =>
|
|
261
|
-
expect( () => { const _ = sm`machine_license:MIT; a->b;`; })
|
|
262
|
-
.not.toThrow() );
|
|
263
|
-
|
|
264
|
-
test('BSD 2-clause', () =>
|
|
265
|
-
expect( () => { const _ = sm`machine_license:BSD 2-clause; a->b;`; })
|
|
266
|
-
.not.toThrow() );
|
|
267
|
-
|
|
268
|
-
test('BSD 3-clause', () =>
|
|
269
|
-
expect( () => { const _ = sm`machine_license:BSD 3-clause; a->b;`; })
|
|
270
|
-
.not.toThrow() );
|
|
271
|
-
|
|
272
|
-
test('Apache 2.0', () =>
|
|
273
|
-
expect( () => { const _ = sm`machine_license:Apache 2.0; a->b;`; })
|
|
274
|
-
.not.toThrow() );
|
|
275
|
-
|
|
276
|
-
test('Mozilla 2.0', () =>
|
|
277
|
-
expect( () => { const _ = sm`machine_license:Mozilla 2.0; a->b;`; })
|
|
278
|
-
.not.toThrow() );
|
|
279
|
-
|
|
280
|
-
test('GPL v2', () =>
|
|
281
|
-
expect( () => { const _ = sm`machine_license:GPL v2; a->b;`; })
|
|
282
|
-
.not.toThrow() );
|
|
283
|
-
|
|
284
|
-
test('GPL v3', () =>
|
|
285
|
-
expect( () => { const _ = sm`machine_license:GPL v3; a->b;`; })
|
|
286
|
-
.not.toThrow() );
|
|
287
|
-
|
|
288
|
-
test('LGPL v2.1', () =>
|
|
289
|
-
expect( () => { const _ = sm`machine_license:LGPL v2.1; a->b;`; })
|
|
290
|
-
.not.toThrow() );
|
|
291
|
-
|
|
292
|
-
test('LGPL v3.0', () =>
|
|
293
|
-
expect( () => { const _ = sm`machine_license:LGPL v3.0; a->b;`; })
|
|
294
|
-
.not.toThrow() );
|
|
295
|
-
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
describe('spaced', () => {
|
|
300
|
-
|
|
301
|
-
test('Public domain', () =>
|
|
302
|
-
expect( () => { const _ = sm`machine_license: Public domain ; a->b;`; })
|
|
303
|
-
.not.toThrow() );
|
|
304
|
-
|
|
305
|
-
test('MIT', () =>
|
|
306
|
-
expect( () => { const _ = sm`machine_license: MIT ; a->b;`; })
|
|
307
|
-
.not.toThrow() );
|
|
308
|
-
|
|
309
|
-
test('BSD 2-clause', () =>
|
|
310
|
-
expect( () => { const _ = sm`machine_license: BSD 2-clause ; a->b;`; })
|
|
311
|
-
.not.toThrow() );
|
|
312
|
-
|
|
313
|
-
test('BSD 3-clause', () =>
|
|
314
|
-
expect( () => { const _ = sm`machine_license: BSD 3-clause ; a->b;`; })
|
|
315
|
-
.not.toThrow() );
|
|
316
|
-
|
|
317
|
-
test('Apache 2.0', () =>
|
|
318
|
-
expect( () => { const _ = sm`machine_license: Apache 2.0 ; a->b;`; })
|
|
319
|
-
.not.toThrow() );
|
|
320
|
-
|
|
321
|
-
test('Mozilla 2.0', () =>
|
|
322
|
-
expect( () => { const _ = sm`machine_license: Mozilla 2.0 ; a->b;`; })
|
|
323
|
-
.not.toThrow() );
|
|
324
|
-
|
|
325
|
-
test('GPL v2', () =>
|
|
326
|
-
expect( () => { const _ = sm`machine_license: GPL v2 ; a->b;`; })
|
|
327
|
-
.not.toThrow() );
|
|
328
|
-
|
|
329
|
-
test('GPL v3', () =>
|
|
330
|
-
expect( () => { const _ = sm`machine_license: GPL v3 ; a->b;`; })
|
|
331
|
-
.not.toThrow() );
|
|
332
|
-
|
|
333
|
-
test('LGPL v2.1', () =>
|
|
334
|
-
expect( () => { const _ = sm`machine_license: LGPL v2.1 ; a->b;`; })
|
|
335
|
-
.not.toThrow() );
|
|
336
|
-
|
|
337
|
-
test('LGPL v3.0', () =>
|
|
338
|
-
expect( () => { const _ = sm`machine_license: LGPL v3.0 ; a->b;`; })
|
|
339
|
-
.not.toThrow() );
|
|
340
|
-
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
test('single atom', () =>
|
|
345
|
-
expect( () => { const _ = sm`machine_license: bob; a->b;`; })
|
|
346
|
-
.not.toThrow() );
|
|
347
|
-
|
|
348
|
-
test('single quoted string', () =>
|
|
349
|
-
expect( () => { const _ = sm`machine_license: "bo b"; a->b;`; })
|
|
350
|
-
.not.toThrow() );
|
|
351
|
-
|
|
352
|
-
});
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
describe('fsl_version', () => {
|
|
359
|
-
|
|
360
|
-
test('semver 0.0.0', () =>
|
|
361
|
-
expect( () => { const _f = sm`fsl_version: 0.0.0; a->b;`; })
|
|
362
|
-
.not.toThrow() );
|
|
363
|
-
|
|
364
|
-
test('semver 0.0.1', () =>
|
|
365
|
-
expect( () => { const _f = sm`fsl_version: 0.0.1; a->b;`; })
|
|
366
|
-
.not.toThrow() );
|
|
367
|
-
|
|
368
|
-
test('semver 0.1.0', () =>
|
|
369
|
-
expect( () => { const _f = sm`fsl_version: 0.1.0; a->b;`; })
|
|
370
|
-
.not.toThrow() );
|
|
371
|
-
|
|
372
|
-
test('semver 1.0.0', () =>
|
|
373
|
-
expect( () => { const _f = sm`fsl_version: 1.0.0; a->b;`; })
|
|
374
|
-
.not.toThrow() );
|
|
375
|
-
|
|
376
|
-
test('semver 1.0.1', () =>
|
|
377
|
-
expect( () => { const _f = sm`fsl_version: 1.0.1; a->b;`; })
|
|
378
|
-
.not.toThrow() );
|
|
379
|
-
|
|
380
|
-
test('semver 1.1.1', () =>
|
|
381
|
-
expect( () => { const _f = sm`fsl_version: 1.1.1; a->b;`; })
|
|
382
|
-
.not.toThrow() );
|
|
383
|
-
|
|
384
|
-
test('semver 2.0.0', () =>
|
|
385
|
-
expect( () => { const _f = sm`fsl_version: 2.0.0; a->b;`; })
|
|
386
|
-
.not.toThrow() );
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
test('semver notAS', () =>
|
|
390
|
-
expect(() => { const _f = sm`fsl_version: "Not a semver"; a->b;`; })
|
|
391
|
-
.toThrow() );
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
test('retval correct', () =>
|
|
395
|
-
expect(sm`fsl_version: 0.0.0; a->b;`.fsl_version())
|
|
396
|
-
.toEqual({full:"0.0.0", major:0, minor:0, patch:0}) );
|
|
397
|
-
|
|
398
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
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
|