loom

Форк
0
/
test-interpret-simodo-script-check.out 
3013 строк · 93.7 Кб
1
Тест работы интерпретатора SBL ====================================
2
--- test/source/simodo-script/check/000-00-Blank.simodo-script :
3

4
--- interpret :
5
Интерпретация выполнена успешно
6
--- test/source/simodo-script/check/000-00-Exceeded.simodo-script :
7
print a
8
print a
9
print a
10
print a
11
print a
12
print a
13
print a
14
print a
15
--- interpret :
16
Ошибка: Variable 'a' not found
17
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:1:7[1,8]
18
Интерпретация прервана
19
--- test/source/simodo-script/check/001-00-PushConstant.simodo-script :
20
print 1
21
--- interpret :
22
1
23
Интерпретация выполнена успешно
24
--- test/source/simodo-script/check/001-01-PushConstant.simodo-script :
25
print "Hello, World!"
26
--- interpret :
27
Hello, World!
28
Интерпретация выполнена успешно
29
--- test/source/simodo-script/check/001-02-PushConstant.simodo-script :
30
print 3.14
31
--- interpret :
32
3.14
33
Интерпретация выполнена успешно
34
--- test/source/simodo-script/check/001-03-PushConstant.simodo-script :
35
print true
36
print false
37
--- interpret :
38
true
39
false
40
Интерпретация выполнена успешно
41
--- test/source/simodo-script/check/001-05-PushConstant.simodo-script :
42
print null
43
--- interpret :
44
<null>
45
Интерпретация выполнена успешно
46
--- test/source/simodo-script/check/002-00-PushVariable.simodo-script :
47
print a
48
--- interpret :
49
Ошибка: Variable 'a' not found
50
Позиция разбора: test/source/simodo-script/check/002-00-PushVariable.simodo-script:1:7[1,8]
51
Интерпретация прервана
52
--- test/source/simodo-script/check/003-00-ObjectElement.simodo-script :
53
print math.pix
54
--- interpret :
55
Ошибка: Property 'pix' not found in 'math'
56
Позиция разбора: test/source/simodo-script/check/003-00-ObjectElement.simodo-script:1:12[1,15]
57
Интерпретация прервана
58
--- test/source/simodo-script/check/003-01-ObjectElement.simodo-script :
59
import test : t
60

61
print t.test_string
62
call t.set_test_string("new value of test string")
63
print t.test_string
64
--- interpret :
65
initial test string
66
new value of test string
67
Интерпретация выполнена успешно
68
--- test/source/simodo-script/check/003-02-ObjectElement.simodo-script :
69
import test : t = { test_string : "initiated value of test string" }
70

71
print t.test_string
72
--- interpret :
73
Ошибка: Using a setter 'test_string' when assigning an object is not supported
74
Позиция разбора: test/source/simodo-script/check/003-02-ObjectElement.simodo-script:1:21[1,32]
75
Интерпретация прервана
76
--- test/source/simodo-script/check/003-03-ObjectElement.simodo-script :
77
import test : t
78

79
print t.test_string
80
t.test_string = "new value of test string"
81
print t.test_string
82
--- interpret :
83
initial test string
84
new value of test string
85
Интерпретация выполнена успешно
86
--- test/source/simodo-script/check/003-04-ObjectElement.simodo-script :
87
print math.spec.origin
88
--- interpret :
89
module
90
Интерпретация выполнена успешно
91
--- test/source/simodo-script/check/004-00-FunctionCall.simodo-script :
92
print math.sin(0.0)
93
--- interpret :
94
0.0
95
Интерпретация выполнена успешно
96
--- test/source/simodo-script/check/004-01-FunctionCall.simodo-script :
97
print math.cos(0.0)
98
--- interpret :
99
1.0
100
Интерпретация выполнена успешно
101
--- test/source/simodo-script/check/004-02-FunctionCall.simodo-script :
102
print math.sin()
103
--- interpret :
104
Ошибка: The function call 'sin' contains an incorrect number of arguments
105
Позиция разбора: test/source/simodo-script/check/004-02-FunctionCall.simodo-script:1:12[1,15]
106
Интерпретация прервана
107
--- test/source/simodo-script/check/004-03-FunctionCall.simodo-script :
108
print math.pi()
109
--- interpret :
110
Ошибка: Invalid type conversion from float to function
111
Позиция разбора: test/source/simodo-script/check/004-03-FunctionCall.simodo-script:1:12[1,14]
112
Интерпретация прервана
113
--- test/source/simodo-script/check/004-04-FunctionCall.simodo-script :
114
print math.sin(0)
115
--- interpret :
116
0.0
117
Интерпретация выполнена успешно
118
--- test/source/simodo-script/check/004-05-FunctionCall.simodo-script :
119
print math.sin(true)
120
--- interpret :
121
Ошибка: Invalid type conversion from bool to float
122
Позиция разбора: test/source/simodo-script/check/004-05-FunctionCall.simodo-script:1:16[1,20]
123
Интерпретация прервана
124
--- test/source/simodo-script/check/006-00-Print.simodo-script :
125
print math
126
--- interpret :
127
{pi:3.141593}
128
Интерпретация выполнена успешно
129
--- test/source/simodo-script/check/006-01-Print.simodo-script :
130
print all math
131
--- interpret :
132
{pi:3.141593, sin:<function>, cos:<function>, tan:<function>, asin:<function>, acos:<function>, atan:<function>, sqrt:<function>, exp:<function>, ln:<function>, atan2ND:<function>, signFloat:<function>, signInt:<function>, asinND:<function>, acosND:<function>, atanND:<function>, clampReal:<function>, clampInt:<function>, absReal:<function>, absInt:<function>}#{origin:"module", builtin:true}
133
Интерпретация выполнена успешно
134
--- test/source/simodo-script/check/009-01-ArrayElement.simodo-script :
135
#{ initial_value : 5 } : a
136

137
print a[0]
138
--- interpret :
139
Ошибка: Invalid type conversion from int to array
140
Позиция разбора: test/source/simodo-script/check/009-01-ArrayElement.simodo-script:3:7[3,8]
141
Интерпретация прервана
142
--- test/source/simodo-script/check/009-02-ArrayElement.simodo-script :
143
#{ initial_value : null } : a = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
144

145
print a
146
print a[0]
147
print a[1]
148
print a[2]
149
print a[1][2]
150
--- interpret :
151
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
152
[1, 2, 3, 4]
153
[5, 6, 7, 8]
154
[9, 10, 11, 12]
155
7
156
Интерпретация выполнена успешно
157
--- test/source/simodo-script/check/009-03-ArrayElement.simodo-script :
158
# {initial_value : null} type auto
159

160
def auto : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
161

162
print x
163
print x[4,1]
164
 --- interpret :
165
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
166
Ошибка: Произошло исключение в методе Array::getValueByIndex при обработке оператора SBL
167
Описание исключения: Out of indexes count
168
Позиция разбора: test/source/simodo-script/check/009-03-ArrayElement.simodo-script:6:11[6,12]
169
Интерпретация прервана
170
--- test/source/simodo-script/check/009-04-ArrayElement.simodo-script :
171
# {initial_value : null} type auto
172

173
def auto : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
174

175
print x
176
print x[4]
177
print x[4][1]
178
 --- interpret :
179
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
180
4
181
Ошибка: Invalid type conversion from int to array
182
Позиция разбора: test/source/simodo-script/check/009-04-ArrayElement.simodo-script:7:8[7,9]
183
Интерпретация прервана
184
--- test/source/simodo-script/check/010-00-ObjectStructure.simodo-script :
185
print all {a: true, a: "b"}
186
--- interpret :
187
Ошибка: Duplicate object element name 'a'
188
Позиция разбора: test/source/simodo-script/check/010-00-ObjectStructure.simodo-script:1:21[1,22]
189
Интерпретация прервана
190
--- test/source/simodo-script/check/012-00-Import.simodo-script :
191
import test : t
192

193
print all t
194
--- interpret :
195
{doc:"Нужно будет предусмотреть поддержку трансляции", test_string:<function>, set_test_string:<function>, fibers:<function>}#{origin:"variable", property:true}
196
Интерпретация выполнена успешно
197
--- test/source/simodo-script/check/012-01-Import.simodo-script :
198
import test type test
199

200
def test : t
201

202
print all t
203
--- interpret :
204
{doc:"Нужно будет предусмотреть поддержку трансляции", test_string:<function>, set_test_string:<function>, fibers:<function>}#{origin:"variable", property:true}
205
Интерпретация выполнена успешно
206
--- test/source/simodo-script/check/012-02-Import.simodo-script :
207
import "/test/source/sbl/check/002-00-PushVariable.simodo-script" {language : "simodo-script"} 
208
    : t
209

210
print all t 
211
--- interpret :
212
Ошибка: Module parameters are not supported
213
Позиция разбора: test/source/simodo-script/check/012-02-Import.simodo-script:1:67[1,68]
214
Интерпретация прервана
215
--- test/source/simodo-script/check/012-03-Import-sample.simodo-script :
216
#{initial_value : ""} : first_name, last_name
217
#{initial_value : 10} : year_of_birth
218
--- interpret :
219
Интерпретация выполнена успешно
220
--- test/source/simodo-script/check/012-04-Import.simodo-script :
221
import "012-03-Import-sample.simodo-script" :
222
        p1 = { first_name : "Иванов", last_name : "Иван" },
223
        p2 = { first_name : "Петров", last_name : "Пётр", year_of_birth : 1998 }
224

225
print "1"
226
print all p1
227
print all p2
228

229
p1.year_of_birth = 2002
230
print "2"
231
print all p1
232
print all p2
233

234
p1 = {first_name : "Сидоров", last_name : "Сидор"}
235
print "3"
236
print all p1
237
print all p2
238

239
p1 = p2
240
print "4"
241
print all p1
242
print all p2
243

244
p2 = {first_name : "Антонов", last_name : "Антон"}
245
print "5"
246
print all p1
247
print all p2
248
--- interpret :
249
1
250
{first_name:"Иванов", last_name:"Иван", year_of_birth:10}#{origin:"variable", property:true}
251
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
252
2
253
{first_name:"Иванов", last_name:"Иван", year_of_birth:2002}#{origin:"variable", property:true}
254
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
255
3
256
{first_name:"Сидоров", last_name:"Сидор", year_of_birth:2002}#{origin:"variable", property:true}
257
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
258
4
259
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
260
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
261
5
262
{first_name:"Петров", last_name:"Пётр", year_of_birth:1998}#{origin:"variable", property:true}
263
{first_name:"Антонов", last_name:"Антон", year_of_birth:1998}#{origin:"variable", property:true}
264
Интерпретация выполнена успешно
265
--- test/source/simodo-script/check/012-06-Import.simodo-script :
266
import test1 type test
267

268
print all test
269
--- interpret :
270
Ошибка: Module 'test1' was not found
271
Позиция разбора: test/source/simodo-script/check/012-06-Import.simodo-script:1:8[1,13]
272
Интерпретация прервана
273
--- test/source/simodo-script/check/012-07-Import.simodo-script :
274
import "015-03-Announcement.simodo-script" : test
275

276
test.x = 3
277
test.i = 2
278
--- interpret :
279
1#{hidden:true, initial_value:0, origin:"variable", property:true}
280
Ошибка: Property 'i' is hidden in 'test' and have not getter 'get_i'
281
Позиция разбора: test/source/simodo-script/check/012-07-Import.simodo-script:4:6[4,7]
282
Интерпретация прервана
283
--- test/source/simodo-script/check/012-08-Import.simodo-script :
284
import test : t
285

286
print t.fibers
287
--- interpret :
288
{2:"Flow"}
289
Интерпретация выполнена успешно
290
--- test/source/simodo-script/check/013-00-Contract.simodo-script :
291
#{} contract bool
292

293
print all bool
294
--- interpret :
295
<null>#{origin:"contract"}
296
Интерпретация выполнена успешно
297
--- test/source/simodo-script/check/013-01-Contract.simodo-script :
298
#{ initial_value : null }  type auto
299
#{ initial_value : true }  type bool
300
#{ initial_value : "" }    type string
301
#{ initial_value : 0 }     type int
302
#{ initial_value : 0.0 }   type float
303

304
print all auto
305
print all bool
306
print all string
307
print all int
308
print all float
309
 --- interpret :
310
<null>#{initial_value:<null>, origin:"type"}
311
<null>#{initial_value:true, origin:"type"}
312
<null>#{initial_value:"", origin:"type"}
313
<null>#{initial_value:0, origin:"type"}
314
<null>#{initial_value:0.0, origin:"type"}
315
Интерпретация выполнена успешно
316
--- test/source/simodo-script/check/013-02-Contract.simodo-script :
317
#{ initial_value : "", mutable : true } contract varstring1
318
#{ initial_value : ""} #{mutable : true } contract varstring2
319

320
print all varstring1
321
print all varstring2
322
--- interpret :
323
<null>#{initial_value:"", mutable:true, origin:"type"}
324
<null>#{initial_value:"", mutable:true, origin:"type"}
325
Интерпретация выполнена успешно
326
--- test/source/simodo-script/check/013-03-Contract.simodo-script :
327
#{mutable : true } import test contract vartest 
328

329
print all vartest
330
--- interpret :
331
{doc:"Нужно будет предусмотреть поддержку трансляции", test_string:<function>, set_test_string:<function>, fibers:<function>}#{mutable:true, origin:"type"}
332
Интерпретация выполнена успешно
333
--- test/source/simodo-script/check/013-04-Contract.simodo-script :
334
#{doc : true } import test contract doctest
335
--- interpret :
336
Интерпретация выполнена успешно
337
--- test/source/simodo-script/check/013-05-Contract.simodo-script :
338
def math.cos(0) contract varcos 
339
--- interpret :
340
Интерпретация выполнена успешно
341
--- test/source/simodo-script/check/013-06-Contract.simodo-script :
342
#{ test : true } contract test_type
343

344
def test_type #{ initial_value : 0.0, mutable : true } import test type Flex
345

346
print all test_type
347
print all Flex
348
--- interpret :
349
Ошибка: Invalid addition of a non-scalar type to a scalar sequence
350
Позиция разбора: test/source/simodo-script/check/013-06-Contract.simodo-script:3:63[3,67]
351
Интерпретация прервана
352
--- test/source/simodo-script/check/013-07-Contract.simodo-script :
353
#{ test : true } contract test_type
354

355
def test_type import test #{ initial_value : 0.0, mutable : true } type Flex
356

357
print all test_type
358
print all Flex
359
--- interpret :
360
Ошибка: Invalid addition of a scalar type to a non-scalar sequence
361
Позиция разбора: test/source/simodo-script/check/013-07-Contract.simodo-script:3:30[3,43]
362
Интерпретация прервана
363
--- test/source/simodo-script/check/015-00-Announcement.simodo-script :
364
#{ initial_value : true } contract bool 
365

366
def bool : ok
367

368
print all ok
369
--- interpret :
370
true#{initial_value:true, origin:"variable", property:true}
371
Интерпретация выполнена успешно
372
--- test/source/simodo-script/check/015-01-Announcement.simodo-script :
373
#{ initial_value : 1 }    contract int
374
#{ initial_value : true } contract bool
375

376
def int bool : ok
377

378
print all ok
379
--- interpret :
380
Ошибка: Type overriding
381
Позиция разбора: test/source/simodo-script/check/015-01-Announcement.simodo-script:4:9[4,13]
382
Интерпретация прервана
383
--- test/source/simodo-script/check/015-02-Announcement.simodo-script :
384
#{ initial_value : true, mutable : true } :
385
    ok,
386
    error
387

388
print all ok
389
print all error
390
--- interpret :
391
true#{initial_value:true, mutable:true, origin:"variable", property:true}
392
true#{initial_value:true, mutable:true, origin:"variable", property:true}
393
Интерпретация выполнена успешно
394
--- test/source/simodo-script/check/015-03-Announcement.simodo-script :
395
def hidden int : i = 1
396
def int : x = 3
397

398
print all i--- interpret :
399
1#{hidden:true, initial_value:0, origin:"variable", property:true}
400
Интерпретация выполнена успешно
401
--- test/source/simodo-script/check/015-04-Announcement.simodo-script :
402
{
403
    def hidden int : i = 1
404
}--- interpret :
405
Ошибка: The internal variables of the module are already hidden
406
Позиция разбора: test/source/simodo-script/check/015-04-Announcement.simodo-script:2:9[2,15]
407
Интерпретация прервана
408
--- test/source/simodo-script/check/016-00-Declaration.simodo-script :
409
#{ initial_value : true } contract bool 
410

411
def bool : ok, ok
412
--- interpret :
413
Ошибка: The name 'ok' has already been declared in the local scope
414
Позиция разбора: test/source/simodo-script/check/016-00-Declaration.simodo-script:3:16[3,18]
415
Интерпретация прервана
416
--- test/source/simodo-script/check/016-01-Declaration.simodo-script :
417
#{ initial_value : true } contract bool
418

419
def bool : ok
420
def bool : ok
421
--- interpret :
422
Ошибка: The name 'ok' has already been declared in the local scope
423
Позиция разбора: test/source/simodo-script/check/016-01-Declaration.simodo-script:4:12[4,14]
424
Интерпретация прервана
425
--- test/source/simodo-script/check/016-02-Declaration.simodo-script :
426
#{ initial_value : true } contract bool
427

428
def bool : ok
429
{ def bool : ok }
430
--- interpret :
431
Интерпретация выполнена успешно
432
--- test/source/simodo-script/check/016-03-Declaration.simodo-script :
433
#{initial_value : null} : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
434

435
print x
436
--- interpret :
437
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
438
Интерпретация выполнена успешно
439
--- test/source/simodo-script/check/017-00-Initialize.simodo-script :
440
#{ mutable : true } contract var
441
#{ initial_value : 0 } contract int 
442

443
def var int : i = 14
444

445
print all i
446
--- interpret :
447
14#{mutable:true, initial_value:0, origin:"variable", property:true}
448
Интерпретация выполнена успешно
449
--- test/source/simodo-script/check/017-01-Initialize.simodo-script :
450
#{ mutable : true } contract var
451

452
def var import test : test = {test_string : 14}
453

454
print all test
455
--- interpret :
456
Ошибка: Using a setter 'test_string' when assigning an object is not supported
457
Позиция разбора: test/source/simodo-script/check/017-01-Initialize.simodo-script:3:31[3,42]
458
Интерпретация прервана
459
--- test/source/simodo-script/check/017-02-Initialize.simodo-script :
460
#{ mutable : true } contract var 
461

462
def var import test : test = {missing_element : 14}
463

464
print all test
465
--- interpret :
466
Ошибка: Element 'missing_element' was not found in the target structure
467
Позиция разбора: test/source/simodo-script/check/017-02-Initialize.simodo-script:3:31[3,46]
468
Интерпретация прервана
469
--- test/source/simodo-script/check/017-03-Initialize.simodo-script :
470
#{ initial_value : null } : test = {a : "a", i : 14}
471

472
print all test
473
--- interpret :
474
{a:"a", i:14}#{initial_value:<null>, origin:"variable", property:true}
475
Интерпретация выполнена успешно
476
--- test/source/simodo-script/check/017-04-Initialize.simodo-script :
477
#{ initial_value : null } contract auto 
478

479
def auto : i = 14
480

481
print all i
482
--- interpret :
483
14#{initial_value:<null>, origin:"variable", property:true}
484
Интерпретация выполнена успешно
485
--- test/source/simodo-script/check/017-05-Initialize.simodo-script :
486
def auto : i = math.cos(0.2)
487

488
print all math.acos(i)
489
--- interpret :
490
0.2
491
Интерпретация выполнена успешно
492
--- test/source/simodo-script/check/020-01-GroupInitialize.simodo-script :
493
def auto : [ a1, b1 ] = { a1 : 1, b1 : 2}
494
def auto : [ b2, a2 ] = { a2 : 1.0, b2 : 2.0}
495

496
print a1
497
print b1
498
print a2
499
print b2
500
--- interpret :
501
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
502
Описание исключения: Incorrect group initialization structure
503
Позиция разбора: test/source/simodo-script/check/020-01-GroupInitialize.simodo-script:1:12[1,13]
504
Интерпретация прервана
505
--- test/source/simodo-script/check/020-02-GroupInitialize.simodo-script :
506
def auto : [ a, b ] = [ "qwerty", 2 ]
507

508
print a
509
print b
510
--- interpret :
511
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
512
Описание исключения: Incorrect group initialization structure
513
Позиция разбора: test/source/simodo-script/check/020-02-GroupInitialize.simodo-script:1:12[1,13]
514
Интерпретация прервана
515
--- test/source/simodo-script/check/020-03-GroupInitialize.simodo-script :
516
def auto : [ , a, , b, ] = [ 1, 2.0, true, "qwerty", 5, null]
517

518
print a // д.б. 2.0
519
print b // д.б. "qwetry"
520
--- interpret :
521
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
522
Описание исключения: Incorrect group initialization structure
523
Позиция разбора: test/source/simodo-script/check/020-03-GroupInitialize.simodo-script:1:12[1,13]
524
Интерпретация прервана
525
--- test/source/simodo-script/check/020-04-GroupInitialize.simodo-script :
526
def auto : [ a ] = 2.0
527

528
print a // д.б. 2.0
529
--- interpret :
530
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
531
Описание исключения: Incorrect group initialization structure
532
Позиция разбора: test/source/simodo-script/check/020-04-GroupInitialize.simodo-script:1:12[1,13]
533
Интерпретация прервана
534
--- test/source/simodo-script/check/020-05-GroupInitialize.simodo-script :
535
def auto : [ a, b ] = 1
536
--- interpret :
537
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
538
Описание исключения: Incorrect group initialization structure
539
Позиция разбора: test/source/simodo-script/check/020-05-GroupInitialize.simodo-script:1:12[1,13]
540
Интерпретация прервана
541
--- test/source/simodo-script/check/023-00-AssignmentAddition.simodo-script :
542
#{ initial_value : 0, mutable : true } : i
543

544
print i
545
i+=2
546
print i
547
--- interpret :
548
0
549
2
550
Интерпретация выполнена успешно
551
--- test/source/simodo-script/check/023-01-AssignmentAddition.simodo-script :
552
#{ initial_value : 0, mutable : true } : i
553

554
print i
555
i += x
556
print i
557
--- interpret :
558
0
559
Ошибка: Variable 'x' not found
560
Позиция разбора: test/source/simodo-script/check/023-01-AssignmentAddition.simodo-script:4:6[4,7]
561
Интерпретация прервана
562
--- test/source/simodo-script/check/024-00-AssignmentSubtraction.simodo-script :
563
#{ initial_value : 0, mutable : true } : i
564

565
print i
566
i -= 2
567
print i
568
--- interpret :
569
0
570
-2
571
Интерпретация выполнена успешно
572
--- test/source/simodo-script/check/025-00-AssignmentMultiplication.simodo-script :
573
#{ initial_value : 10, mutable : true } : i
574

575
print i
576
i *= 5
577
print i
578
--- interpret :
579
10
580
50
581
Интерпретация выполнена успешно
582
--- test/source/simodo-script/check/026-00-AssignmentDivision.simodo-script :
583
#{ initial_value : 10, mutable : true } : i
584

585
print i
586
i /= 5
587
print i
588
--- interpret :
589
10
590
2
591
Интерпретация выполнена успешно
592
--- test/source/simodo-script/check/027-00-AssignmentModulo.simodo-script :
593
#{ initial_value : 13, mutable : true } : i
594

595
print i
596
i %= 5
597
print i
598
--- interpret :
599
13
600
3
601
Интерпретация выполнена успешно
602
--- test/source/simodo-script/check/031-00-FunctionDefinition.simodo-script :
603
#{ initial_value : null } type auto 
604
#{ initial_value : 0 }    type int 
605

606
def int  : x = 12
607
def auto : f = fn [x] (int : y) { print x+y }
608

609
x = -10
610

611
call f(4)
612
--- interpret :
613
16
614
Интерпретация выполнена успешно
615
--- test/source/simodo-script/check/031-01-FunctionDefinition.simodo-script :
616
#{ initial_value : null } type auto 
617
#{ initial_value : 0 }    type int 
618

619
def int  : x = 12
620
def auto : f = fn [x1] (int : y) { print x+y }
621

622
call f(4)
623
--- interpret :
624
Ошибка: Variable 'x1' not found
625
Позиция разбора: test/source/simodo-script/check/031-01-FunctionDefinition.simodo-script:5:20[5,22]
626
Интерпретация прервана
627
--- test/source/simodo-script/check/031-02-FunctionDefinition.simodo-script :
628
#{ initial_value : null } type auto 
629
#{ initial_value : 0 }    type int 
630

631
def int  : x = 12
632
def auto : f = fn [x] (int : y) -> int { return x+y }
633

634
print f(4)
635
--- interpret :
636
16
637
Интерпретация выполнена успешно
638
--- test/source/simodo-script/check/031-03-FunctionDefinition.simodo-script :
639
#{ initial_value : null } type auto 
640
#{ initial_value : 0 }    type int
641

642
def int  : x = 12
643
def auto : f = fn [x] (int : y1) -> int { return x+y }
644

645
print f(4)
646
--- interpret :
647
Ошибка: Variable 'y' not found
648
Позиция разбора: test/source/simodo-script/check/031-03-FunctionDefinition.simodo-script:5:52[5,53]
649
Интерпретация прервана
650
--- test/source/simodo-script/check/031-04-FunctionDefinition.simodo-script :
651
#{ initial_value : null } type auto 
652
#{ initial_value : 0 }    type int
653

654
def int  : x = 12
655
def auto : f = fn [x] (int : y) -> auto { return x+y }
656

657
x = -10
658

659
print f(4)
660
print x
661
--- interpret :
662
16
663
-10
664
Интерпретация выполнена успешно
665
--- test/source/simodo-script/check/031-05-FunctionDefinition.simodo-script :
666
#{ initial_value : null } type auto 
667
#{ initial_value : 0 }    type int
668

669
def int  : x = 12
670
def auto : f = fn [x] (int : y) -> int 
671
            {
672
                if (y > 0)
673
                    return x+y
674
                print "Wrong way"
675
                return 0
676
            }
677

678
print f(5)
679
--- interpret :
680
17
681
Интерпретация выполнена успешно
682
--- test/source/simodo-script/check/031-06-FunctionDefinition.simodo-script :
683
#{ initial_value : null } type auto 
684
#{ initial_value : 0 }    type int
685

686
def int  : x = 12
687
def auto : f = fn [x] (int : y) -> int 
688
            {
689
                if (y > 0) {
690
                    return x+y
691
                }
692
                print "Wrong way"
693
                return 0
694
            }
695
--- interpret :
696
Интерпретация выполнена успешно
697
--- test/source/simodo-script/check/031-07-FunctionDefinition.simodo-script :
698
#{ initial_value : null } type auto 
699
#{ initial_value : 0 }    type int
700

701
def int  : x = 12
702
def auto : f = fn [x, auto, int] (int : y) -> int 
703
            {
704
                def auto : f = fn [x,y] () -> int { return x+y }
705
                return f()
706
            }
707

708
print f(5)
709
--- interpret :
710
17
711
Интерпретация выполнена успешно
712
--- test/source/simodo-script/check/031-08-FunctionDefinition.simodo-script :
713
import "031-06-FunctionDefinition.simodo-script" type m
714

715
print m.f(2)
716
--- interpret :
717
14
718
Интерпретация выполнена успешно
719
--- test/source/simodo-script/check/031-09-FunctionDefinition.simodo-script :
720
#{ initial_value : null } type auto 
721
#{ initial_value : 0 }    type int
722

723
def int : m1 = 3, m2 = 5
724

725
def auto : mult = fn [] (int : x, int : y) -> int { return (x*y) }
726

727
print mult(m1, m2)
728
--- interpret :
729
15
730
Интерпретация выполнена успешно
731
--- test/source/simodo-script/check/031-10-FunctionDefinition.simodo-script :
732
def auto : factor = fn [factor] (int : x) -> int 
733
                {
734
                    if (x <= 1)
735
                        return 1
736
    
737
                    return x*factor(x-1)
738
                }
739

740
print factor(10)
741
--- interpret :
742
3628800
743
Интерпретация выполнена успешно
744
--- test/source/simodo-script/check/031-11-FunctionDefinition.simodo-script :
745
import "031-10-FunctionDefinition.simodo-script" type f
746

747
print f.factor(5)
748
--- interpret :
749
3628800
750
120
751
Интерпретация выполнена успешно
752
--- test/source/simodo-script/check/031-12-FunctionDefinition.simodo-script :
753
#{ initial_value : null } type auto 
754
#{ initial_value : 0 }    type int
755

756
def auto :
757
    x = 1,
758
    factor = fn [factor] (int : x) -> int
759
        {
760
            if (x <= 1)
761
                return 1
762

763
            return x*factor(x-1)
764
        },
765
    y = 2
766

767
print factor(10)
768
--- interpret :
769
3628800
770
Интерпретация выполнена успешно
771
--- test/source/simodo-script/check/031-13-FunctionDefinition.simodo-script :
772
#{ initial_value : null } type auto 
773
#{ initial_value : 0 }    type int 
774

775
def int  : x = 12
776
def auto : f = fn [x] (int : x) { print x }
777

778
call f(4)
779
--- interpret :
780
Ошибка: The argument and closure have the same names
781
Позиция разбора: test/source/simodo-script/check/031-13-FunctionDefinition.simodo-script:5:30[5,31]
782
Интерпретация прервана
783
--- test/source/simodo-script/check/031-14-FunctionDefinition.simodo-script :
784
#{ initial_value : null } type auto 
785
#{ initial_value : 0 }    type int 
786

787
def int  : x = 12,
788
       y = 2
789
       
790
def auto : f = fn [*] () -> int { return x+y }
791

792
print f()
793
--- interpret :
794
14
795
Интерпретация выполнена успешно
796
--- test/source/simodo-script/check/031-15-FunctionDefinition.simodo-script :
797
fn factor(int : x) -> int 
798
{
799
    if (x <= 1)
800
        return 1
801

802
    return x*factor(x-1)
803
}
804

805
print factor(5)
806
--- interpret :
807
120
808
Интерпретация выполнена успешно
809
--- test/source/simodo-script/check/035-00-Return.simodo-script :
810

811
return
812
--- interpret :
813
Ошибка: Inappropriate use of the return statement
814
Позиция разбора: test/source/simodo-script/check/035-00-Return.simodo-script:2:1[2,7]
815
Интерпретация прервана
816
--- test/source/simodo-script/check/035-01-Return.simodo-script :
817
import "035-00-Return.simodo-script" type ret
818

819
--- interpret :
820
Ошибка: Inappropriate use of the return statement
821
Позиция разбора: test/source/simodo-script/check/035-00-Return.simodo-script:2:1[2,7]
822
Интерпретация прервана
823
--- test/source/simodo-script/check/041-01-Plus.simodo-script :
824
print +1
825

826
#{ initial_value : 2 } : ok
827

828
print +ok
829
--- interpret :
830
1
831
2
832
Интерпретация выполнена успешно
833
--- test/source/simodo-script/check/041-02-Plus.simodo-script :
834
print +1.0
835

836
#{ initial_value : 2.0 } : ok
837

838
print +ok
839
--- interpret :
840
1.0
841
2.0
842
Интерпретация выполнена успешно
843
--- test/source/simodo-script/check/041-03-Plus.simodo-script :
844
print +""
845
--- interpret :
846
Ошибка: Invalid type conversion from string to int
847
Позиция разбора: test/source/simodo-script/check/041-03-Plus.simodo-script:1:8[1,10]
848
Интерпретация прервана
849
--- test/source/simodo-script/check/042-01-Minus.simodo-script :
850
#{ initial_value : -2 } : ok
851

852
print -ok
853
--- interpret :
854
2
855
Интерпретация выполнена успешно
856
--- test/source/simodo-script/check/042-02-Minus.simodo-script :
857
#{ initial_value : -2.0 } : ok
858

859
print ok
860
print -ok
861
--- interpret :
862
-2.0
863
2.0
864
Интерпретация выполнена успешно
865
--- test/source/simodo-script/check/042-02-Ternary.simodo-script :
866
print false ? "false" : "true"
867
--- interpret :
868
true
869
Интерпретация выполнена успешно
870
--- test/source/simodo-script/check/042-03-Minus.simodo-script :
871
print -""
872
--- interpret :
873
Ошибка: Invalid type conversion from string to int
874
Позиция разбора: test/source/simodo-script/check/042-03-Minus.simodo-script:1:8[1,10]
875
Интерпретация прервана
876
--- test/source/simodo-script/check/042-03-Ternary.simodo-script :
877
print false ? "false" : true ? "true" : "false"
878
--- interpret :
879
true
880
Интерпретация выполнена успешно
881
--- test/source/simodo-script/check/042-04-Ternary.simodo-script :
882
print true ? true ? "true" : "false" : "false"
883
--- interpret :
884
true
885
Интерпретация выполнена успешно
886
--- test/source/simodo-script/check/043-01-Not.simodo-script :
887
#{ initial_value : true } : ok
888

889
print !ok
890
--- interpret :
891
false
892
Интерпретация выполнена успешно
893
--- test/source/simodo-script/check/043-02-Not.simodo-script :
894
#{ initial_value : 0 } : ok
895

896
print !ok
897
--- interpret :
898
Ошибка: Invalid type conversion from int to bool
899
Позиция разбора: test/source/simodo-script/check/043-02-Not.simodo-script:1:26[1,28]
900
Интерпретация прервана
901
--- test/source/simodo-script/check/051-01-Or.simodo-script :
902
print true || true
903
print true || false
904
print false || true
905
print false || false
906
--- interpret :
907
true
908
true
909
true
910
false
911
Интерпретация выполнена успешно
912
--- test/source/simodo-script/check/051-02-Or.simodo-script :
913
print true || 1
914
--- interpret :
915
Ошибка: Invalid type conversion from int to bool
916
Позиция разбора: test/source/simodo-script/check/051-02-Or.simodo-script:1:15[1,16]
917
Интерпретация прервана
918
--- test/source/simodo-script/check/051-03-Or.simodo-script :
919
print true || null
920
--- interpret :
921
Ошибка: Invalid type conversion from null to bool
922
Позиция разбора: test/source/simodo-script/check/051-03-Or.simodo-script:1:15[1,19]
923
Интерпретация прервана
924
--- test/source/simodo-script/check/051-04-Or.simodo-script :
925
print null || false
926
--- interpret :
927
Ошибка: Invalid type conversion from null to bool
928
Позиция разбора: test/source/simodo-script/check/051-04-Or.simodo-script:1:7[1,11]
929
Интерпретация прервана
930
--- test/source/simodo-script/check/052-01-And.simodo-script :
931
print true && true
932
print true && false
933
print false && true
934
print false && false
935
--- interpret :
936
true
937
false
938
false
939
false
940
Интерпретация выполнена успешно
941
--- test/source/simodo-script/check/053-01-Equal.simodo-script :
942
print true == true
943
print true == false
944
print 1 == 1
945
print 1 == 2
946
print 1. == 1
947
print 1. == 2
948
print 1 == 1.
949
print 1 == 2.
950
print "one" == "one"
951
print "one" == "two"
952
--- interpret :
953
true
954
false
955
true
956
false
957
true
958
false
959
true
960
false
961
true
962
false
963
Интерпретация выполнена успешно
964
--- test/source/simodo-script/check/054-01-NotEqual.simodo-script :
965
print true != true
966
print true != false
967
print 1 != 1
968
print 1 != 2
969
print 1. != 1
970
print 1. != 2
971
print 1 != 1.
972
print 1 != 2.
973
print "one" != "one"
974
print "one" != "two"
975
--- interpret :
976
false
977
true
978
false
979
true
980
false
981
true
982
false
983
true
984
false
985
true
986
Интерпретация выполнена успешно
987
--- test/source/simodo-script/check/055-01-Less.simodo-script :
988
print 1 < 1
989
print 1 < 2
990
print 1. < 1
991
print 1. < 2
992
print 1 < 1.
993
print 1 < 2.
994
print "one" < "one"
995
print "one" < "two"
996
--- interpret :
997
false
998
true
999
false
1000
true
1001
false
1002
true
1003
false
1004
true
1005
Интерпретация выполнена успешно
1006
--- test/source/simodo-script/check/055-02-Less.simodo-script :
1007
print true < true
1008
--- interpret :
1009
Ошибка: For operation Less, the use of types bool and bool is not provided
1010
Позиция разбора: test/source/simodo-script/check/055-02-Less.simodo-script:1:7[1,18]
1011
Интерпретация прервана
1012
--- test/source/simodo-script/check/055-03-Less.simodo-script :
1013

1014
print 0 < //null
1015
        (4 < null 
1016
            ? true 
1017
            : false)
1018
--- interpret :
1019
Ошибка: For operation Less, the use of types int and null is not provided
1020
Позиция разбора: test/source/simodo-script/check/055-03-Less.simodo-script:3:10[3,18]
1021
Интерпретация прервана
1022
--- test/source/simodo-script/check/056-01-LessOrEqual.simodo-script :
1023
print 1 <= 1
1024
print 1 <= 2
1025
print 1. <= 1
1026
print 1. <= 2
1027
print 1 <= 1.
1028
print 1 <= 2.
1029
print "one" <= "one"
1030
print "one" <= "two"
1031
--- interpret :
1032
true
1033
true
1034
true
1035
true
1036
true
1037
true
1038
true
1039
true
1040
Интерпретация выполнена успешно
1041
--- test/source/simodo-script/check/057-01-More.simodo-script :
1042
print 1 > 1
1043
print 1 > 2
1044
print 1. > 1
1045
print 1. > 2
1046
print 1 > 1.
1047
print 1 > 2.
1048
print "one" > "one"
1049
print "one" > "two"
1050
--- interpret :
1051
false
1052
false
1053
false
1054
false
1055
false
1056
false
1057
false
1058
false
1059
Интерпретация выполнена успешно
1060
--- test/source/simodo-script/check/058-01-MoreOrEqual.simodo-script :
1061
print 1 >= 1
1062
print 1 >= 2
1063
print 1. >= 1
1064
print 1. >= 2
1065
print 1 >= 1.
1066
print 1 >= 2.
1067
print "one" >= "one"
1068
print "one" >= "two"
1069
--- interpret :
1070
true
1071
false
1072
true
1073
false
1074
true
1075
false
1076
true
1077
false
1078
Интерпретация выполнена успешно
1079
--- test/source/simodo-script/check/061-01-Addition.simodo-script :
1080
print 1 + 2
1081
print 1. + 2
1082
print 1 + 2.
1083
print 1. + 2.
1084
print "one" + "one"
1085
print "one" + true
1086
print "one" + 2
1087
print "one" + 2.
1088
print false + "one"
1089
print 1 + "one"
1090
print 1. + "one"
1091
--- interpret :
1092
3
1093
3.0
1094
3.0
1095
3.0
1096
oneone
1097
onetrue
1098
one2
1099
one2.0
1100
falseone
1101
1one
1102
1.0one
1103
Интерпретация выполнена успешно
1104
--- test/source/simodo-script/check/061-02-Addition.simodo-script :
1105
print 1 + null
1106
--- interpret :
1107
Ошибка: For operation Addition, the use of types int and null is not provided
1108
Позиция разбора: test/source/simodo-script/check/061-02-Addition.simodo-script:1:7[1,15]
1109
Интерпретация прервана
1110
--- test/source/simodo-script/check/061-03-Addition.simodo-script :
1111
def int :
1112
    op1 = 3,
1113
    op2 = 5
1114
print op1 + op2
1115
--- interpret :
1116
8
1117
Интерпретация выполнена успешно
1118
--- test/source/simodo-script/check/062-01-Subtraction.simodo-script :
1119
print 1 - 2
1120
print 1. - 2
1121
print 1 - 2.
1122
print 1. - 2.
1123
--- interpret :
1124
-1
1125
-1.0
1126
-1.0
1127
-1.0
1128
Интерпретация выполнена успешно
1129
--- test/source/simodo-script/check/062-02-Subtraction.simodo-script :
1130
print "1" - 2
1131
--- interpret :
1132
Ошибка: For operation Subtraction, the use of types string and string is not provided
1133
Позиция разбора: test/source/simodo-script/check/062-02-Subtraction.simodo-script:1:7[1,14]
1134
Интерпретация прервана
1135
--- test/source/simodo-script/check/063-01-Multiplication.simodo-script :
1136
print 3 * 2
1137
print 3. * 2
1138
print 3 * 2.
1139
print 3. * 2.
1140
--- interpret :
1141
6
1142
6.0
1143
6.0
1144
6.0
1145
Интерпретация выполнена успешно
1146
--- test/source/simodo-script/check/064-01-Division.simodo-script :
1147
print 3 / 2
1148
print 3. / 2
1149
print 3 / 2.
1150
print 3. / 2.
1151
--- interpret :
1152
1
1153
1.5
1154
1.5
1155
1.5
1156
Интерпретация выполнена успешно
1157
--- test/source/simodo-script/check/064-02-Division.simodo-script :
1158
print 3 / 0
1159
--- interpret :
1160
Ошибка: Произошло исключение при обработке оператора SBL
1161
Описание исключения: Деление на ноль
1162
Позиция разбора: test/source/simodo-script/check/064-02-Division.simodo-script:1:9[1,10]
1163
Интерпретация прервана
1164
--- test/source/simodo-script/check/064-03-Division.simodo-script :
1165
print 3.0 / 0.0
1166
--- interpret :
1167
Ошибка: Произошло исключение при обработке оператора SBL
1168
Описание исключения: Деление на ноль
1169
Позиция разбора: test/source/simodo-script/check/064-03-Division.simodo-script:1:11[1,12]
1170
Интерпретация прервана
1171
--- test/source/simodo-script/check/065-01-Modulo.simodo-script :
1172
print 3 % 2
1173
--- interpret :
1174
1
1175
Интерпретация выполнена успешно
1176
--- test/source/simodo-script/check/065-02-Modulo.simodo-script :
1177
#{ built_in_type : 2 } :
1178
    a = 13,
1179
    b = 3
1180

1181
print (a/b)*b + a%b == a
1182
--- interpret :
1183
true
1184
Интерпретация выполнена успешно
1185
--- test/source/simodo-script/check/066-01-Power.simodo-script :
1186
print 3 ^ 2
1187
print 3.5 ^ 2
1188
print 3.5 ^ 2.
1189
--- interpret :
1190
9.0
1191
12.25
1192
12.25
1193
Интерпретация выполнена успешно
1194
--- test/source/simodo-script/check/072-01-If.simodo-script :
1195
if true
1196
    print "Ok"
1197
print "Done"
1198
--- interpret :
1199
Ok
1200
Done
1201
Интерпретация выполнена успешно
1202
--- test/source/simodo-script/check/072-02-If.simodo-script :
1203
if false
1204
    print "Wrong"
1205
print "Done"
1206
--- interpret :
1207
Done
1208
Интерпретация выполнена успешно
1209
--- test/source/simodo-script/check/072-03-If.simodo-script :
1210
if false
1211
    print "Wrong"
1212
else
1213
    print "Ok"
1214
print "Done"
1215
--- interpret :
1216
Ok
1217
Done
1218
Интерпретация выполнена успешно
1219
--- test/source/simodo-script/check/072-04-If.simodo-script :
1220
if (true)
1221
    print "Ok"
1222
else
1223
    print "Wrong"
1224
print "Done"
1225
--- interpret :
1226
Ok
1227
Done
1228
Интерпретация выполнена успешно
1229
--- test/source/simodo-script/check/072-05-If.simodo-script :
1230
if (false)
1231
    print "Wrong"
1232
else if (true)
1233
    print "Ok"
1234
else
1235
    print "Wrong"
1236
print "Done"
1237
--- interpret :
1238
Ok
1239
Done
1240
Интерпретация выполнена успешно
1241
--- test/source/simodo-script/check/081-00-For.simodo-script :
1242
for int : i in [1,2,3]
1243
    print i
1244

1245
print "Done"
1246
--- interpret :
1247
1
1248
2
1249
3
1250
Done
1251
Интерпретация выполнена успешно
1252
--- test/source/simodo-script/check/081-01-For.simodo-script :
1253
#{ initial_value : null } type 
1254
    Range = 
1255
    {
1256
        begin   : 0,
1257
        end     : 0,
1258
        counter : 0,
1259
        __init__ : fn [Range] (int : b, int : e) -> Range
1260
        {
1261
            def Range : range
1262
            
1263
            range.begin = b
1264
            range.end = e
1265
            range.counter = b - 1
1266
            
1267
            return range
1268
        },
1269
        __iterator__ : fn (Range : range)
1270
        {
1271
            range.counter += 1
1272
            return [range.counter, range.counter <= range.end]
1273
        }
1274
    } 
1275

1276
for int : i in Range(1,4)
1277
    print i
1278

1279
print "Done"
1280
--- interpret :
1281
1
1282
2
1283
3
1284
4
1285
Done
1286
Интерпретация выполнена успешно
1287
--- test/source/simodo-script/check/081-02-For.simodo-script :
1288
def int :
1289
    begin   = 0,
1290
    end     = 0,
1291
    counter = 0
1292
    
1293
def auto :
1294
    __init__ = fn [self] (int : b, int : e) -> auto
1295
        {
1296
            def self : s
1297
        
1298
            s.begin = b
1299
            s.end = e
1300
            s.counter = b - 1
1301
            
1302
            return s
1303
        },
1304
    __iterator__ = fn (self : s) -> auto 
1305
        {
1306
            s.counter += 1
1307
            return [s.counter, s.counter <= s.end]
1308
        }
1309
        --- interpret :
1310
Интерпретация выполнена успешно
1311
--- test/source/simodo-script/check/081-03-For.simodo-script :
1312
import "081-02-For.simodo-script" type range
1313

1314
def range(2,3) : i
1315

1316
print all i
1317

1318
print i.__iterator__(i)
1319
print i.__iterator__(i)
1320
print i.__iterator__(i)
1321

1322
print "Done"
1323
 --- interpret :
1324
{begin:2, end:3, counter:1, __init__:<function>, __iterator__:<function>}#{origin:"variable", property:true}
1325
[2, true]
1326
[3, true]
1327
[4, false]
1328
Done
1329
Интерпретация выполнена успешно
1330
--- test/source/simodo-script/check/081-04-For.simodo-script :
1331
import "081-02-For.simodo-script" type range
1332

1333
for int : i in range(-1,4)
1334
    print i
1335

1336
print "Done"
1337
--- interpret :
1338
-1
1339
0
1340
1
1341
2
1342
3
1343
4
1344
Done
1345
Интерпретация выполнена успешно
1346
--- test/source/simodo-script/check/081-05-For.simodo-script :
1347
def int :
1348
    begin   = 0,
1349
    end     = 0,
1350
    counter = 0
1351
    
1352
def auto :
1353
    __init__ = fn [self] (int : b, int : e) -> auto
1354
        {
1355
            def self : s
1356
        
1357
            s.begin = b
1358
            s.end = e
1359
            s.counter = b - 1
1360
            
1361
            return s
1362
        },
1363
    __iterator__ = fn (self : s) -> auto 
1364
        {
1365
            s.counter += 1
1366
            return s.counter
1367
        }
1368
        --- interpret :
1369
Интерпретация выполнена успешно
1370
--- test/source/simodo-script/check/081-06-For.simodo-script :
1371
import "081-05-For.simodo-script" type range
1372

1373
for int : i in range(-1,4)
1374
    print i
1375

1376
print "Done"
1377
--- interpret :
1378
Ошибка: The iterator of the iteration should return values in the form of a vector in the format: [value, bool : condition]
1379
Позиция разбора: test/source/simodo-script/check/081-06-For.simodo-script:3:16[3,21]
1380
Интерпретация прервана
1381
--- test/source/simodo-script/check/082-00-While.simodo-script :
1382
def int : i = 1
1383

1384
while i < 5000 
1385
    i += 1
1386

1387
print i
1388
--- interpret :
1389
5000
1390
Интерпретация выполнена успешно
1391
--- test/source/simodo-script/check/082-01-While.simodo-script :
1392
def int : i = 1, count = 0
1393
    
1394
while i < 500 {
1395
    if i % 2 == 0
1396
        count += i
1397
    i += 1
1398
}
1399

1400
print count
1401
--- interpret :
1402
62250
1403
Интерпретация выполнена успешно
1404
--- test/source/simodo-script/check/083-00-DoWhile.simodo-script :
1405
def int : i = -10
1406

1407
do {
1408
    if i > 5000 break
1409
    i += 1
1410
}
1411
while true
1412

1413
print i
1414
--- interpret :
1415
5001
1416
Интерпретация выполнена успешно
1417
--- test/source/simodo-script/check/085-00-Break.simodo-script :
1418
def int : i = 1
1419

1420
while true {
1421
    if i == 4 break
1422
    print i
1423
    i += 1
1424
}
1425

1426
print "Done"
1427
--- interpret :
1428
1
1429
2
1430
3
1431
Done
1432
Интерпретация выполнена успешно
1433
--- test/source/simodo-script/check/085-01-Break.simodo-script :
1434
def int : i = 1
1435

1436
if i == 4 break
1437

1438
print "Done"
1439
--- interpret :
1440
Done
1441
Интерпретация выполнена успешно
1442
--- test/source/simodo-script/check/085-02-Break.simodo-script :
1443
def int : res;
1444

1445
do
1446
{
1447
    def auto : div = fn (int : x, int : y) -> int
1448
        {
1449
            if y == 0 break
1450
            return x/y 
1451
        }
1452
    
1453
    res =  div(4,0)
1454
}
1455
while res < 0
1456
--- interpret :
1457
Ошибка: Inappropriate use of the 'break' statement
1458
Позиция разбора: test/source/simodo-script/check/085-02-Break.simodo-script:7:23[7,28]
1459
Интерпретация прервана
1460
--- test/source/simodo-script/check/086-00-Continue.simodo-script :
1461
def int : i = -10
1462

1463
do {
1464
    i += 1
1465
    if i < 1 continue
1466
    print i
1467
}
1468
while i < 4
1469

1470
print "Done"
1471
--- interpret :
1472
1
1473
2
1474
3
1475
4
1476
Done
1477
Интерпретация выполнена успешно
1478
--- test/source/simodo-script/check/086-01-Continue.simodo-script :
1479
def int : i = 1
1480

1481
if i == 4 continue
1482

1483
print "Done"
1484
--- interpret :
1485
Done
1486
Интерпретация выполнена успешно
1487
--- test/source/simodo-script/check/086-02-Continue.simodo-script :
1488
def int : res;
1489

1490
do {
1491
    def auto : div = fn (int : x, int : y) -> int
1492
        {
1493
            if y == 0 continue
1494
            return x/y 
1495
        }
1496
    
1497
    res =  div(4,0)
1498
}
1499
while res < 0
1500
--- interpret :
1501
Ошибка: Inappropriate use of the 'continue' statement
1502
Позиция разбора: test/source/simodo-script/check/086-02-Continue.simodo-script:6:23[6,31]
1503
Интерпретация прервана
1504
--- test/source/simodo-script/check/110-01-FiberMake.simodo-script :
1505
import "/test/source/simodo-script/import/primes.simodo-script" type Primes : p1
1506

1507
make_fiber p1
1508

1509
flow p1.prime(1,100)
1510

1511
wait p1
1512
 --- interpret :
1513
1
1514
3
1515
5
1516
7
1517
11
1518
13
1519
17
1520
19
1521
23
1522
29
1523
31
1524
37
1525
41
1526
43
1527
47
1528
53
1529
59
1530
61
1531
67
1532
71
1533
73
1534
79
1535
83
1536
89
1537
97
1538
Интерпретация выполнена успешно
1539
--- test/source/simodo-script/check/110-02-FiberMake.simodo-script :
1540
import "/test/source/simodo-script/import/asynch.simodo-script"
1541
    : async
1542

1543
def auto : factor = fn [factor] (int : x) -> int 
1544
{
1545
    if (x <= 1)
1546
        return 1
1547

1548
    return x*factor(x-1)
1549
}
1550

1551
//auto : f = asynch.future(factor, 10)
1552
def auto : f = async.future( fn [factor] () { return factor(10) } )
1553
def int  : i = factor(10)
1554

1555
print i
1556
print i == f.get()
1557
--- interpret :
1558
3628800
1559
true
1560
Интерпретация выполнена успешно
1561
--- test/source/simodo-script/check/110-03-FiberMake.simodo-script :
1562
import "/test/source/simodo-script/import/primes.simodo-script" type Primes : p1
1563

1564
make_fiber p1
1565

1566
flow p1.prime(1,100)
1567

1568
//wait p1
1569
 --- interpret :
1570
1
1571
3
1572
5
1573
7
1574
11
1575
13
1576
17
1577
19
1578
23
1579
29
1580
31
1581
37
1582
41
1583
43
1584
47
1585
53
1586
59
1587
61
1588
67
1589
71
1590
73
1591
79
1592
83
1593
89
1594
97
1595
Интерпретация выполнена успешно
1596
--- test/source/simodo-script/check/113-01-FiberPush.simodo-script :
1597
import "/test/source/simodo-script/import/state-pi.simodo-script" type Pi : pi
1598

1599
make_fiber pi
1600

1601
pi.pi = math.pi
1602

1603
flow pi.print_pi()
1604

1605
push pi
1606

1607
flow pi.print_pi()
1608

1609
wait pi
1610
--- interpret :
1611
0.0
1612
3.141593
1613
Интерпретация выполнена успешно
1614
--- test/source/simodo-script/check/114-01-FiberPull.simodo-script :
1615
import "/test/source/simodo-script/import/state-pi.simodo-script" type Pi : pi
1616

1617
make_fiber pi
1618

1619
flow pi.pi_low()
1620

1621
print pi
1622

1623
pull pi
1624

1625
print pi
1626

1627
flow pi.pi_hight()
1628

1629
pull pi
1630

1631
print pi
1632

1633
wait pi
1634
--- interpret :
1635
{pi:0.0}
1636
{pi:3.142857}
1637
{pi:3.141593}
1638
Интерпретация выполнена успешно
1639
Тест работы анализатора SBL ====================================
1640
--- test/source/simodo-script/check/000-00-Blank.simodo-script :
1641

1642
--- interpret :
1643
Интерпретация выполнена успешно
1644
--- test/source/simodo-script/check/000-00-Exceeded.simodo-script :
1645
print a
1646
print a
1647
print a
1648
print a
1649
print a
1650
print a
1651
print a
1652
print a
1653
--- interpret :
1654
Ошибка: Variable 'a' not found
1655
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:1:7[1,8]
1656
Ошибка: Variable 'a' not found
1657
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:2:7[2,8]
1658
Ошибка: Variable 'a' not found
1659
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:3:7[3,8]
1660
Ошибка: Variable 'a' not found
1661
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:4:7[4,8]
1662
Ошибка: Variable 'a' not found
1663
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:5:7[5,8]
1664
Ошибка: The number of errors has exceeded the allowable limit
1665
Позиция разбора: test/source/simodo-script/check/000-00-Exceeded.simodo-script:5:7[5,8]
1666
Интерпретация прервана
1667
--- test/source/simodo-script/check/001-00-PushConstant.simodo-script :
1668
print 1
1669
--- interpret :
1670
Интерпретация выполнена успешно
1671
--- test/source/simodo-script/check/001-01-PushConstant.simodo-script :
1672
print "Hello, World!"
1673
--- interpret :
1674
Интерпретация выполнена успешно
1675
--- test/source/simodo-script/check/001-02-PushConstant.simodo-script :
1676
print 3.14
1677
--- interpret :
1678
Интерпретация выполнена успешно
1679
--- test/source/simodo-script/check/001-03-PushConstant.simodo-script :
1680
print true
1681
print false
1682
--- interpret :
1683
Интерпретация выполнена успешно
1684
--- test/source/simodo-script/check/001-05-PushConstant.simodo-script :
1685
print null
1686
--- interpret :
1687
Интерпретация выполнена успешно
1688
--- test/source/simodo-script/check/002-00-PushVariable.simodo-script :
1689
print a
1690
--- interpret :
1691
Ошибка: Variable 'a' not found
1692
Позиция разбора: test/source/simodo-script/check/002-00-PushVariable.simodo-script:1:7[1,8]
1693
Интерпретация выполнена успешно
1694
--- test/source/simodo-script/check/003-00-ObjectElement.simodo-script :
1695
print math.pix
1696
--- interpret :
1697
Ошибка: Property 'pix' not found in 'math'
1698
Позиция разбора: test/source/simodo-script/check/003-00-ObjectElement.simodo-script:1:12[1,15]
1699
Интерпретация выполнена успешно
1700
--- test/source/simodo-script/check/003-01-ObjectElement.simodo-script :
1701
import test : t
1702

1703
print t.test_string
1704
call t.set_test_string("new value of test string")
1705
print t.test_string
1706
--- interpret :
1707
Интерпретация выполнена успешно
1708
--- test/source/simodo-script/check/003-02-ObjectElement.simodo-script :
1709
import test : t = { test_string : "initiated value of test string" }
1710

1711
print t.test_string
1712
--- interpret :
1713
Ошибка: Using a setter 'test_string' when assigning an object is not supported
1714
Позиция разбора: test/source/simodo-script/check/003-02-ObjectElement.simodo-script:1:21[1,32]
1715
Интерпретация прервана
1716
--- test/source/simodo-script/check/003-03-ObjectElement.simodo-script :
1717
import test : t
1718

1719
print t.test_string
1720
t.test_string = "new value of test string"
1721
print t.test_string
1722
--- interpret :
1723
Интерпретация выполнена успешно
1724
--- test/source/simodo-script/check/003-04-ObjectElement.simodo-script :
1725
print math.spec.origin
1726
--- interpret :
1727
Интерпретация выполнена успешно
1728
--- test/source/simodo-script/check/004-00-FunctionCall.simodo-script :
1729
print math.sin(0.0)
1730
--- interpret :
1731
Интерпретация выполнена успешно
1732
--- test/source/simodo-script/check/004-01-FunctionCall.simodo-script :
1733
print math.cos(0.0)
1734
--- interpret :
1735
Интерпретация выполнена успешно
1736
--- test/source/simodo-script/check/004-02-FunctionCall.simodo-script :
1737
print math.sin()
1738
--- interpret :
1739
Ошибка: The function call 'sin' contains an incorrect number of arguments
1740
Позиция разбора: test/source/simodo-script/check/004-02-FunctionCall.simodo-script:1:12[1,15]
1741
Интерпретация выполнена успешно
1742
--- test/source/simodo-script/check/004-03-FunctionCall.simodo-script :
1743
print math.pi()
1744
--- interpret :
1745
Ошибка: Invalid type conversion from float to function
1746
Позиция разбора: test/source/simodo-script/check/004-03-FunctionCall.simodo-script:1:12[1,14]
1747
Интерпретация выполнена успешно
1748
--- test/source/simodo-script/check/004-04-FunctionCall.simodo-script :
1749
print math.sin(0)
1750
--- interpret :
1751
Интерпретация выполнена успешно
1752
--- test/source/simodo-script/check/004-05-FunctionCall.simodo-script :
1753
print math.sin(true)
1754
--- interpret :
1755
Ошибка: Invalid type conversion from bool to float
1756
Позиция разбора: test/source/simodo-script/check/004-05-FunctionCall.simodo-script:1:16[1,20]
1757
Интерпретация прервана
1758
--- test/source/simodo-script/check/006-00-Print.simodo-script :
1759
print math
1760
--- interpret :
1761
Интерпретация выполнена успешно
1762
--- test/source/simodo-script/check/006-01-Print.simodo-script :
1763
print all math
1764
--- interpret :
1765
Интерпретация выполнена успешно
1766
--- test/source/simodo-script/check/009-01-ArrayElement.simodo-script :
1767
#{ initial_value : 5 } : a
1768

1769
print a[0]
1770
--- interpret :
1771
Ошибка: Invalid type conversion from int to array
1772
Позиция разбора: test/source/simodo-script/check/009-01-ArrayElement.simodo-script:3:7[3,8]
1773
Интерпретация выполнена успешно
1774
--- test/source/simodo-script/check/009-02-ArrayElement.simodo-script :
1775
#{ initial_value : null } : a = [[1,2,3,4],[5,6,7,8],[9,10,11,12]]
1776

1777
print a
1778
print a[0]
1779
print a[1]
1780
print a[2]
1781
print a[1][2]
1782
--- interpret :
1783
Интерпретация выполнена успешно
1784
--- test/source/simodo-script/check/009-03-ArrayElement.simodo-script :
1785
# {initial_value : null} type auto
1786

1787
def auto : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
1788

1789
print x
1790
print x[4,1]
1791
 --- interpret :
1792
Ошибка: Произошло исключение в методе Array::getValueByIndex при обработке оператора SBL
1793
Описание исключения: Out of indexes count
1794
Позиция разбора: test/source/simodo-script/check/009-03-ArrayElement.simodo-script:6:11[6,12]
1795
Интерпретация прервана
1796
--- test/source/simodo-script/check/009-04-ArrayElement.simodo-script :
1797
# {initial_value : null} type auto
1798

1799
def auto : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
1800

1801
print x
1802
print x[4]
1803
print x[4][1]
1804
 --- interpret :
1805
Ошибка: Invalid type conversion from int to array
1806
Позиция разбора: test/source/simodo-script/check/009-04-ArrayElement.simodo-script:7:8[7,9]
1807
Интерпретация выполнена успешно
1808
--- test/source/simodo-script/check/010-00-ObjectStructure.simodo-script :
1809
print all {a: true, a: "b"}
1810
--- interpret :
1811
Ошибка: Duplicate object element name 'a'
1812
Позиция разбора: test/source/simodo-script/check/010-00-ObjectStructure.simodo-script:1:21[1,22]
1813
Интерпретация прервана
1814
--- test/source/simodo-script/check/012-00-Import.simodo-script :
1815
import test : t
1816

1817
print all t
1818
--- interpret :
1819
Интерпретация выполнена успешно
1820
--- test/source/simodo-script/check/012-01-Import.simodo-script :
1821
import test type test
1822

1823
def test : t
1824

1825
print all t
1826
--- interpret :
1827
Интерпретация выполнена успешно
1828
--- test/source/simodo-script/check/012-02-Import.simodo-script :
1829
import "/test/source/sbl/check/002-00-PushVariable.simodo-script" {language : "simodo-script"} 
1830
    : t
1831

1832
print all t 
1833
--- interpret :
1834
Ошибка: Module parameters are not supported
1835
Позиция разбора: test/source/simodo-script/check/012-02-Import.simodo-script:1:67[1,68]
1836
Интерпретация выполнена успешно
1837
--- test/source/simodo-script/check/012-03-Import-sample.simodo-script :
1838
#{initial_value : ""} : first_name, last_name
1839
#{initial_value : 10} : year_of_birth
1840
--- interpret :
1841
Интерпретация выполнена успешно
1842
--- test/source/simodo-script/check/012-04-Import.simodo-script :
1843
import "012-03-Import-sample.simodo-script" :
1844
        p1 = { first_name : "Иванов", last_name : "Иван" },
1845
        p2 = { first_name : "Петров", last_name : "Пётр", year_of_birth : 1998 }
1846

1847
print "1"
1848
print all p1
1849
print all p2
1850

1851
p1.year_of_birth = 2002
1852
print "2"
1853
print all p1
1854
print all p2
1855

1856
p1 = {first_name : "Сидоров", last_name : "Сидор"}
1857
print "3"
1858
print all p1
1859
print all p2
1860

1861
p1 = p2
1862
print "4"
1863
print all p1
1864
print all p2
1865

1866
p2 = {first_name : "Антонов", last_name : "Антон"}
1867
print "5"
1868
print all p1
1869
print all p2
1870
--- interpret :
1871
Интерпретация выполнена успешно
1872
--- test/source/simodo-script/check/012-06-Import.simodo-script :
1873
import test1 type test
1874

1875
print all test
1876
--- interpret :
1877
Ошибка: Module 'test1' was not found
1878
Позиция разбора: test/source/simodo-script/check/012-06-Import.simodo-script:1:8[1,13]
1879
Интерпретация выполнена успешно
1880
--- test/source/simodo-script/check/012-07-Import.simodo-script :
1881
import "015-03-Announcement.simodo-script" : test
1882

1883
test.x = 3
1884
test.i = 2
1885
--- interpret :
1886
Ошибка: Property 'i' is hidden in 'test' and have not getter 'get_i'
1887
Позиция разбора: test/source/simodo-script/check/012-07-Import.simodo-script:4:6[4,7]
1888
Интерпретация выполнена успешно
1889
--- test/source/simodo-script/check/012-08-Import.simodo-script :
1890
import test : t
1891

1892
print t.fibers
1893
--- interpret :
1894
Интерпретация выполнена успешно
1895
--- test/source/simodo-script/check/013-00-Contract.simodo-script :
1896
#{} contract bool
1897

1898
print all bool
1899
--- interpret :
1900
Интерпретация выполнена успешно
1901
--- test/source/simodo-script/check/013-01-Contract.simodo-script :
1902
#{ initial_value : null }  type auto
1903
#{ initial_value : true }  type bool
1904
#{ initial_value : "" }    type string
1905
#{ initial_value : 0 }     type int
1906
#{ initial_value : 0.0 }   type float
1907

1908
print all auto
1909
print all bool
1910
print all string
1911
print all int
1912
print all float
1913
 --- interpret :
1914
Интерпретация выполнена успешно
1915
--- test/source/simodo-script/check/013-02-Contract.simodo-script :
1916
#{ initial_value : "", mutable : true } contract varstring1
1917
#{ initial_value : ""} #{mutable : true } contract varstring2
1918

1919
print all varstring1
1920
print all varstring2
1921
--- interpret :
1922
Интерпретация выполнена успешно
1923
--- test/source/simodo-script/check/013-03-Contract.simodo-script :
1924
#{mutable : true } import test contract vartest 
1925

1926
print all vartest
1927
--- interpret :
1928
Интерпретация выполнена успешно
1929
--- test/source/simodo-script/check/013-04-Contract.simodo-script :
1930
#{doc : true } import test contract doctest
1931
--- interpret :
1932
Интерпретация выполнена успешно
1933
--- test/source/simodo-script/check/013-05-Contract.simodo-script :
1934
def math.cos(0) contract varcos 
1935
--- interpret :
1936
Интерпретация выполнена успешно
1937
--- test/source/simodo-script/check/013-06-Contract.simodo-script :
1938
#{ test : true } contract test_type
1939

1940
def test_type #{ initial_value : 0.0, mutable : true } import test type Flex
1941

1942
print all test_type
1943
print all Flex
1944
--- interpret :
1945
Ошибка: Invalid addition of a non-scalar type to a scalar sequence
1946
Позиция разбора: test/source/simodo-script/check/013-06-Contract.simodo-script:3:63[3,67]
1947
Интерпретация выполнена успешно
1948
--- test/source/simodo-script/check/013-07-Contract.simodo-script :
1949
#{ test : true } contract test_type
1950

1951
def test_type import test #{ initial_value : 0.0, mutable : true } type Flex
1952

1953
print all test_type
1954
print all Flex
1955
--- interpret :
1956
Ошибка: Invalid addition of a scalar type to a non-scalar sequence
1957
Позиция разбора: test/source/simodo-script/check/013-07-Contract.simodo-script:3:30[3,43]
1958
Интерпретация выполнена успешно
1959
--- test/source/simodo-script/check/015-00-Announcement.simodo-script :
1960
#{ initial_value : true } contract bool 
1961

1962
def bool : ok
1963

1964
print all ok
1965
--- interpret :
1966
Интерпретация выполнена успешно
1967
--- test/source/simodo-script/check/015-01-Announcement.simodo-script :
1968
#{ initial_value : 1 }    contract int
1969
#{ initial_value : true } contract bool
1970

1971
def int bool : ok
1972

1973
print all ok
1974
--- interpret :
1975
Ошибка: Type overriding
1976
Позиция разбора: test/source/simodo-script/check/015-01-Announcement.simodo-script:4:9[4,13]
1977
Интерпретация выполнена успешно
1978
--- test/source/simodo-script/check/015-02-Announcement.simodo-script :
1979
#{ initial_value : true, mutable : true } :
1980
    ok,
1981
    error
1982

1983
print all ok
1984
print all error
1985
--- interpret :
1986
Интерпретация выполнена успешно
1987
--- test/source/simodo-script/check/015-03-Announcement.simodo-script :
1988
def hidden int : i = 1
1989
def int : x = 3
1990

1991
print all i--- interpret :
1992
Интерпретация выполнена успешно
1993
--- test/source/simodo-script/check/015-04-Announcement.simodo-script :
1994
{
1995
    def hidden int : i = 1
1996
}--- interpret :
1997
Ошибка: The internal variables of the module are already hidden
1998
Позиция разбора: test/source/simodo-script/check/015-04-Announcement.simodo-script:2:9[2,15]
1999
Интерпретация выполнена успешно
2000
--- test/source/simodo-script/check/016-00-Declaration.simodo-script :
2001
#{ initial_value : true } contract bool 
2002

2003
def bool : ok, ok
2004
--- interpret :
2005
Ошибка: The name 'ok' has already been declared in the local scope
2006
Позиция разбора: test/source/simodo-script/check/016-00-Declaration.simodo-script:3:16[3,18]
2007
Интерпретация выполнена успешно
2008
--- test/source/simodo-script/check/016-01-Declaration.simodo-script :
2009
#{ initial_value : true } contract bool
2010

2011
def bool : ok
2012
def bool : ok
2013
--- interpret :
2014
Ошибка: The name 'ok' has already been declared in the local scope
2015
Позиция разбора: test/source/simodo-script/check/016-01-Declaration.simodo-script:4:12[4,14]
2016
Интерпретация выполнена успешно
2017
--- test/source/simodo-script/check/016-02-Declaration.simodo-script :
2018
#{ initial_value : true } contract bool
2019

2020
def bool : ok
2021
{ def bool : ok }
2022
--- interpret :
2023
Интерпретация выполнена успешно
2024
--- test/source/simodo-script/check/016-03-Declaration.simodo-script :
2025
#{initial_value : null} : x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2026

2027
print x
2028
--- interpret :
2029
Интерпретация выполнена успешно
2030
--- test/source/simodo-script/check/017-00-Initialize.simodo-script :
2031
#{ mutable : true } contract var
2032
#{ initial_value : 0 } contract int 
2033

2034
def var int : i = 14
2035

2036
print all i
2037
--- interpret :
2038
Интерпретация выполнена успешно
2039
--- test/source/simodo-script/check/017-01-Initialize.simodo-script :
2040
#{ mutable : true } contract var
2041

2042
def var import test : test = {test_string : 14}
2043

2044
print all test
2045
--- interpret :
2046
Ошибка: Using a setter 'test_string' when assigning an object is not supported
2047
Позиция разбора: test/source/simodo-script/check/017-01-Initialize.simodo-script:3:31[3,42]
2048
Интерпретация прервана
2049
--- test/source/simodo-script/check/017-02-Initialize.simodo-script :
2050
#{ mutable : true } contract var 
2051

2052
def var import test : test = {missing_element : 14}
2053

2054
print all test
2055
--- interpret :
2056
Ошибка: Element 'missing_element' was not found in the target structure
2057
Позиция разбора: test/source/simodo-script/check/017-02-Initialize.simodo-script:3:31[3,46]
2058
Интерпретация прервана
2059
--- test/source/simodo-script/check/017-03-Initialize.simodo-script :
2060
#{ initial_value : null } : test = {a : "a", i : 14}
2061

2062
print all test
2063
--- interpret :
2064
Интерпретация выполнена успешно
2065
--- test/source/simodo-script/check/017-04-Initialize.simodo-script :
2066
#{ initial_value : null } contract auto 
2067

2068
def auto : i = 14
2069

2070
print all i
2071
--- interpret :
2072
Интерпретация выполнена успешно
2073
--- test/source/simodo-script/check/017-05-Initialize.simodo-script :
2074
def auto : i = math.cos(0.2)
2075

2076
print all math.acos(i)
2077
--- interpret :
2078
Интерпретация выполнена успешно
2079
--- test/source/simodo-script/check/020-01-GroupInitialize.simodo-script :
2080
def auto : [ a1, b1 ] = { a1 : 1, b1 : 2}
2081
def auto : [ b2, a2 ] = { a2 : 1.0, b2 : 2.0}
2082

2083
print a1
2084
print b1
2085
print a2
2086
print b2
2087
--- interpret :
2088
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
2089
Описание исключения: Incorrect group initialization structure
2090
Позиция разбора: test/source/simodo-script/check/020-01-GroupInitialize.simodo-script:1:12[1,13]
2091
Интерпретация прервана
2092
--- test/source/simodo-script/check/020-02-GroupInitialize.simodo-script :
2093
def auto : [ a, b ] = [ "qwerty", 2 ]
2094

2095
print a
2096
print b
2097
--- interpret :
2098
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
2099
Описание исключения: Incorrect group initialization structure
2100
Позиция разбора: test/source/simodo-script/check/020-02-GroupInitialize.simodo-script:1:12[1,13]
2101
Интерпретация прервана
2102
--- test/source/simodo-script/check/020-03-GroupInitialize.simodo-script :
2103
def auto : [ , a, , b, ] = [ 1, 2.0, true, "qwerty", 5, null]
2104

2105
print a // д.б. 2.0
2106
print b // д.б. "qwetry"
2107
--- interpret :
2108
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
2109
Описание исключения: Incorrect group initialization structure
2110
Позиция разбора: test/source/simodo-script/check/020-03-GroupInitialize.simodo-script:1:12[1,13]
2111
Интерпретация прервана
2112
--- test/source/simodo-script/check/020-04-GroupInitialize.simodo-script :
2113
def auto : [ a ] = 2.0
2114

2115
print a // д.б. 2.0
2116
--- interpret :
2117
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
2118
Описание исключения: Incorrect group initialization structure
2119
Позиция разбора: test/source/simodo-script/check/020-04-GroupInitialize.simodo-script:1:12[1,13]
2120
Интерпретация прервана
2121
--- test/source/simodo-script/check/020-05-GroupInitialize.simodo-script :
2122
def auto : [ a, b ] = 1
2123
--- interpret :
2124
Ошибка: Произошло исключение в методе OperationParser::parseGroupInitialize при обработке оператора SBL
2125
Описание исключения: Incorrect group initialization structure
2126
Позиция разбора: test/source/simodo-script/check/020-05-GroupInitialize.simodo-script:1:12[1,13]
2127
Интерпретация прервана
2128
--- test/source/simodo-script/check/023-00-AssignmentAddition.simodo-script :
2129
#{ initial_value : 0, mutable : true } : i
2130

2131
print i
2132
i+=2
2133
print i
2134
--- interpret :
2135
Интерпретация выполнена успешно
2136
--- test/source/simodo-script/check/023-01-AssignmentAddition.simodo-script :
2137
#{ initial_value : 0, mutable : true } : i
2138

2139
print i
2140
i += x
2141
print i
2142
--- interpret :
2143
Ошибка: Variable 'x' not found
2144
Позиция разбора: test/source/simodo-script/check/023-01-AssignmentAddition.simodo-script:4:6[4,7]
2145
Интерпретация выполнена успешно
2146
--- test/source/simodo-script/check/024-00-AssignmentSubtraction.simodo-script :
2147
#{ initial_value : 0, mutable : true } : i
2148

2149
print i
2150
i -= 2
2151
print i
2152
--- interpret :
2153
Интерпретация выполнена успешно
2154
--- test/source/simodo-script/check/025-00-AssignmentMultiplication.simodo-script :
2155
#{ initial_value : 10, mutable : true } : i
2156

2157
print i
2158
i *= 5
2159
print i
2160
--- interpret :
2161
Интерпретация выполнена успешно
2162
--- test/source/simodo-script/check/026-00-AssignmentDivision.simodo-script :
2163
#{ initial_value : 10, mutable : true } : i
2164

2165
print i
2166
i /= 5
2167
print i
2168
--- interpret :
2169
Интерпретация выполнена успешно
2170
--- test/source/simodo-script/check/027-00-AssignmentModulo.simodo-script :
2171
#{ initial_value : 13, mutable : true } : i
2172

2173
print i
2174
i %= 5
2175
print i
2176
--- interpret :
2177
Интерпретация выполнена успешно
2178
--- test/source/simodo-script/check/031-00-FunctionDefinition.simodo-script :
2179
#{ initial_value : null } type auto 
2180
#{ initial_value : 0 }    type int 
2181

2182
def int  : x = 12
2183
def auto : f = fn [x] (int : y) { print x+y }
2184

2185
x = -10
2186

2187
call f(4)
2188
--- interpret :
2189
Интерпретация выполнена успешно
2190
--- test/source/simodo-script/check/031-01-FunctionDefinition.simodo-script :
2191
#{ initial_value : null } type auto 
2192
#{ initial_value : 0 }    type int 
2193

2194
def int  : x = 12
2195
def auto : f = fn [x1] (int : y) { print x+y }
2196

2197
call f(4)
2198
--- interpret :
2199
Ошибка: Variable 'x1' not found
2200
Позиция разбора: test/source/simodo-script/check/031-01-FunctionDefinition.simodo-script:5:20[5,22]
2201
Ошибка: Invalid type conversion from null to function
2202
Позиция разбора: test/source/simodo-script/check/031-01-FunctionDefinition.simodo-script:7:6[7,7]
2203
Интерпретация выполнена успешно
2204
--- test/source/simodo-script/check/031-02-FunctionDefinition.simodo-script :
2205
#{ initial_value : null } type auto 
2206
#{ initial_value : 0 }    type int 
2207

2208
def int  : x = 12
2209
def auto : f = fn [x] (int : y) -> int { return x+y }
2210

2211
print f(4)
2212
--- interpret :
2213
Интерпретация выполнена успешно
2214
--- test/source/simodo-script/check/031-03-FunctionDefinition.simodo-script :
2215
#{ initial_value : null } type auto 
2216
#{ initial_value : 0 }    type int
2217

2218
def int  : x = 12
2219
def auto : f = fn [x] (int : y1) -> int { return x+y }
2220

2221
print f(4)
2222
--- interpret :
2223
Ошибка: Variable 'y' not found
2224
Позиция разбора: test/source/simodo-script/check/031-03-FunctionDefinition.simodo-script:5:52[5,53]
2225
Интерпретация выполнена успешно
2226
--- test/source/simodo-script/check/031-04-FunctionDefinition.simodo-script :
2227
#{ initial_value : null } type auto 
2228
#{ initial_value : 0 }    type int
2229

2230
def int  : x = 12
2231
def auto : f = fn [x] (int : y) -> auto { return x+y }
2232

2233
x = -10
2234

2235
print f(4)
2236
print x
2237
--- interpret :
2238
Интерпретация выполнена успешно
2239
--- test/source/simodo-script/check/031-05-FunctionDefinition.simodo-script :
2240
#{ initial_value : null } type auto 
2241
#{ initial_value : 0 }    type int
2242

2243
def int  : x = 12
2244
def auto : f = fn [x] (int : y) -> int 
2245
            {
2246
                if (y > 0)
2247
                    return x+y
2248
                print "Wrong way"
2249
                return 0
2250
            }
2251

2252
print f(5)
2253
--- interpret :
2254
Интерпретация выполнена успешно
2255
--- test/source/simodo-script/check/031-06-FunctionDefinition.simodo-script :
2256
#{ initial_value : null } type auto 
2257
#{ initial_value : 0 }    type int
2258

2259
def int  : x = 12
2260
def auto : f = fn [x] (int : y) -> int 
2261
            {
2262
                if (y > 0) {
2263
                    return x+y
2264
                }
2265
                print "Wrong way"
2266
                return 0
2267
            }
2268
--- interpret :
2269
Интерпретация выполнена успешно
2270
--- test/source/simodo-script/check/031-07-FunctionDefinition.simodo-script :
2271
#{ initial_value : null } type auto 
2272
#{ initial_value : 0 }    type int
2273

2274
def int  : x = 12
2275
def auto : f = fn [x, auto, int] (int : y) -> int 
2276
            {
2277
                def auto : f = fn [x,y] () -> int { return x+y }
2278
                return f()
2279
            }
2280

2281
print f(5)
2282
--- interpret :
2283
Интерпретация выполнена успешно
2284
--- test/source/simodo-script/check/031-08-FunctionDefinition.simodo-script :
2285
import "031-06-FunctionDefinition.simodo-script" type m
2286

2287
print m.f(2)
2288
--- interpret :
2289
Интерпретация выполнена успешно
2290
--- test/source/simodo-script/check/031-09-FunctionDefinition.simodo-script :
2291
#{ initial_value : null } type auto 
2292
#{ initial_value : 0 }    type int
2293

2294
def int : m1 = 3, m2 = 5
2295

2296
def auto : mult = fn [] (int : x, int : y) -> int { return (x*y) }
2297

2298
print mult(m1, m2)
2299
--- interpret :
2300
Интерпретация выполнена успешно
2301
--- test/source/simodo-script/check/031-10-FunctionDefinition.simodo-script :
2302
def auto : factor = fn [factor] (int : x) -> int 
2303
                {
2304
                    if (x <= 1)
2305
                        return 1
2306
    
2307
                    return x*factor(x-1)
2308
                }
2309

2310
print factor(10)
2311
--- interpret :
2312
Интерпретация выполнена успешно
2313
--- test/source/simodo-script/check/031-11-FunctionDefinition.simodo-script :
2314
import "031-10-FunctionDefinition.simodo-script" type f
2315

2316
print f.factor(5)
2317
--- interpret :
2318
Интерпретация выполнена успешно
2319
--- test/source/simodo-script/check/031-12-FunctionDefinition.simodo-script :
2320
#{ initial_value : null } type auto 
2321
#{ initial_value : 0 }    type int
2322

2323
def auto :
2324
    x = 1,
2325
    factor = fn [factor] (int : x) -> int
2326
        {
2327
            if (x <= 1)
2328
                return 1
2329

2330
            return x*factor(x-1)
2331
        },
2332
    y = 2
2333

2334
print factor(10)
2335
--- interpret :
2336
Интерпретация выполнена успешно
2337
--- test/source/simodo-script/check/031-13-FunctionDefinition.simodo-script :
2338
#{ initial_value : null } type auto 
2339
#{ initial_value : 0 }    type int 
2340

2341
def int  : x = 12
2342
def auto : f = fn [x] (int : x) { print x }
2343

2344
call f(4)
2345
--- interpret :
2346
Ошибка: The argument and closure have the same names
2347
Позиция разбора: test/source/simodo-script/check/031-13-FunctionDefinition.simodo-script:5:30[5,31]
2348
Интерпретация прервана
2349
--- test/source/simodo-script/check/031-14-FunctionDefinition.simodo-script :
2350
#{ initial_value : null } type auto 
2351
#{ initial_value : 0 }    type int 
2352

2353
def int  : x = 12,
2354
       y = 2
2355
       
2356
def auto : f = fn [*] () -> int { return x+y }
2357

2358
print f()
2359
--- interpret :
2360
Интерпретация выполнена успешно
2361
--- test/source/simodo-script/check/031-15-FunctionDefinition.simodo-script :
2362
fn factor(int : x) -> int 
2363
{
2364
    if (x <= 1)
2365
        return 1
2366

2367
    return x*factor(x-1)
2368
}
2369

2370
print factor(5)
2371
--- interpret :
2372
Интерпретация выполнена успешно
2373
--- test/source/simodo-script/check/035-00-Return.simodo-script :
2374

2375
return
2376
--- interpret :
2377
Ошибка: Inappropriate use of the return statement
2378
Позиция разбора: test/source/simodo-script/check/035-00-Return.simodo-script:2:1[2,7]
2379
Интерпретация выполнена успешно
2380
--- test/source/simodo-script/check/035-01-Return.simodo-script :
2381
import "035-00-Return.simodo-script" type ret
2382

2383
--- interpret :
2384
Ошибка: Inappropriate use of the return statement
2385
Позиция разбора: test/source/simodo-script/check/035-00-Return.simodo-script:2:1[2,7]
2386
Интерпретация выполнена успешно
2387
--- test/source/simodo-script/check/041-01-Plus.simodo-script :
2388
print +1
2389

2390
#{ initial_value : 2 } : ok
2391

2392
print +ok
2393
--- interpret :
2394
Интерпретация выполнена успешно
2395
--- test/source/simodo-script/check/041-02-Plus.simodo-script :
2396
print +1.0
2397

2398
#{ initial_value : 2.0 } : ok
2399

2400
print +ok
2401
--- interpret :
2402
Интерпретация выполнена успешно
2403
--- test/source/simodo-script/check/041-03-Plus.simodo-script :
2404
print +""
2405
--- interpret :
2406
Ошибка: Invalid type conversion from string to int
2407
Позиция разбора: test/source/simodo-script/check/041-03-Plus.simodo-script:1:8[1,10]
2408
Интерпретация выполнена успешно
2409
--- test/source/simodo-script/check/042-01-Minus.simodo-script :
2410
#{ initial_value : -2 } : ok
2411

2412
print -ok
2413
--- interpret :
2414
Интерпретация выполнена успешно
2415
--- test/source/simodo-script/check/042-02-Minus.simodo-script :
2416
#{ initial_value : -2.0 } : ok
2417

2418
print ok
2419
print -ok
2420
--- interpret :
2421
Интерпретация выполнена успешно
2422
--- test/source/simodo-script/check/042-02-Ternary.simodo-script :
2423
print false ? "false" : "true"
2424
--- interpret :
2425
Интерпретация выполнена успешно
2426
--- test/source/simodo-script/check/042-03-Minus.simodo-script :
2427
print -""
2428
--- interpret :
2429
Ошибка: Invalid type conversion from string to int
2430
Позиция разбора: test/source/simodo-script/check/042-03-Minus.simodo-script:1:8[1,10]
2431
Интерпретация выполнена успешно
2432
--- test/source/simodo-script/check/042-03-Ternary.simodo-script :
2433
print false ? "false" : true ? "true" : "false"
2434
--- interpret :
2435
Интерпретация выполнена успешно
2436
--- test/source/simodo-script/check/042-04-Ternary.simodo-script :
2437
print true ? true ? "true" : "false" : "false"
2438
--- interpret :
2439
Интерпретация выполнена успешно
2440
--- test/source/simodo-script/check/043-01-Not.simodo-script :
2441
#{ initial_value : true } : ok
2442

2443
print !ok
2444
--- interpret :
2445
Интерпретация выполнена успешно
2446
--- test/source/simodo-script/check/043-02-Not.simodo-script :
2447
#{ initial_value : 0 } : ok
2448

2449
print !ok
2450
--- interpret :
2451
Ошибка: Invalid type conversion from int to bool
2452
Позиция разбора: test/source/simodo-script/check/043-02-Not.simodo-script:1:26[1,28]
2453
Интерпретация выполнена успешно
2454
--- test/source/simodo-script/check/051-01-Or.simodo-script :
2455
print true || true
2456
print true || false
2457
print false || true
2458
print false || false
2459
--- interpret :
2460
Интерпретация выполнена успешно
2461
--- test/source/simodo-script/check/051-02-Or.simodo-script :
2462
print true || 1
2463
--- interpret :
2464
Ошибка: Invalid type conversion from int to bool
2465
Позиция разбора: test/source/simodo-script/check/051-02-Or.simodo-script:1:15[1,16]
2466
Интерпретация выполнена успешно
2467
--- test/source/simodo-script/check/051-03-Or.simodo-script :
2468
print true || null
2469
--- interpret :
2470
Ошибка: Invalid type conversion from null to bool
2471
Позиция разбора: test/source/simodo-script/check/051-03-Or.simodo-script:1:15[1,19]
2472
Интерпретация выполнена успешно
2473
--- test/source/simodo-script/check/051-04-Or.simodo-script :
2474
print null || false
2475
--- interpret :
2476
Ошибка: Invalid type conversion from null to bool
2477
Позиция разбора: test/source/simodo-script/check/051-04-Or.simodo-script:1:7[1,11]
2478
Интерпретация выполнена успешно
2479
--- test/source/simodo-script/check/052-01-And.simodo-script :
2480
print true && true
2481
print true && false
2482
print false && true
2483
print false && false
2484
--- interpret :
2485
Интерпретация выполнена успешно
2486
--- test/source/simodo-script/check/053-01-Equal.simodo-script :
2487
print true == true
2488
print true == false
2489
print 1 == 1
2490
print 1 == 2
2491
print 1. == 1
2492
print 1. == 2
2493
print 1 == 1.
2494
print 1 == 2.
2495
print "one" == "one"
2496
print "one" == "two"
2497
--- interpret :
2498
Интерпретация выполнена успешно
2499
--- test/source/simodo-script/check/054-01-NotEqual.simodo-script :
2500
print true != true
2501
print true != false
2502
print 1 != 1
2503
print 1 != 2
2504
print 1. != 1
2505
print 1. != 2
2506
print 1 != 1.
2507
print 1 != 2.
2508
print "one" != "one"
2509
print "one" != "two"
2510
--- interpret :
2511
Интерпретация выполнена успешно
2512
--- test/source/simodo-script/check/055-01-Less.simodo-script :
2513
print 1 < 1
2514
print 1 < 2
2515
print 1. < 1
2516
print 1. < 2
2517
print 1 < 1.
2518
print 1 < 2.
2519
print "one" < "one"
2520
print "one" < "two"
2521
--- interpret :
2522
Интерпретация выполнена успешно
2523
--- test/source/simodo-script/check/055-02-Less.simodo-script :
2524
print true < true
2525
--- interpret :
2526
Ошибка: For operation Less, the use of types bool and bool is not provided
2527
Позиция разбора: test/source/simodo-script/check/055-02-Less.simodo-script:1:7[1,18]
2528
Интерпретация выполнена успешно
2529
--- test/source/simodo-script/check/055-03-Less.simodo-script :
2530

2531
print 0 < //null
2532
        (4 < null 
2533
            ? true 
2534
            : false)
2535
--- interpret :
2536
Ошибка: For operation Less, the use of types int and null is not provided
2537
Позиция разбора: test/source/simodo-script/check/055-03-Less.simodo-script:3:10[3,18]
2538
Ошибка: For operation Less, the use of types bool and bool is not provided
2539
Позиция разбора: test/source/simodo-script/check/055-03-Less.simodo-script:2:7[5,21]
2540
Интерпретация выполнена успешно
2541
--- test/source/simodo-script/check/056-01-LessOrEqual.simodo-script :
2542
print 1 <= 1
2543
print 1 <= 2
2544
print 1. <= 1
2545
print 1. <= 2
2546
print 1 <= 1.
2547
print 1 <= 2.
2548
print "one" <= "one"
2549
print "one" <= "two"
2550
--- interpret :
2551
Интерпретация выполнена успешно
2552
--- test/source/simodo-script/check/057-01-More.simodo-script :
2553
print 1 > 1
2554
print 1 > 2
2555
print 1. > 1
2556
print 1. > 2
2557
print 1 > 1.
2558
print 1 > 2.
2559
print "one" > "one"
2560
print "one" > "two"
2561
--- interpret :
2562
Интерпретация выполнена успешно
2563
--- test/source/simodo-script/check/058-01-MoreOrEqual.simodo-script :
2564
print 1 >= 1
2565
print 1 >= 2
2566
print 1. >= 1
2567
print 1. >= 2
2568
print 1 >= 1.
2569
print 1 >= 2.
2570
print "one" >= "one"
2571
print "one" >= "two"
2572
--- interpret :
2573
Интерпретация выполнена успешно
2574
--- test/source/simodo-script/check/061-01-Addition.simodo-script :
2575
print 1 + 2
2576
print 1. + 2
2577
print 1 + 2.
2578
print 1. + 2.
2579
print "one" + "one"
2580
print "one" + true
2581
print "one" + 2
2582
print "one" + 2.
2583
print false + "one"
2584
print 1 + "one"
2585
print 1. + "one"
2586
--- interpret :
2587
Интерпретация выполнена успешно
2588
--- test/source/simodo-script/check/061-02-Addition.simodo-script :
2589
print 1 + null
2590
--- interpret :
2591
Ошибка: For operation Addition, the use of types int and null is not provided
2592
Позиция разбора: test/source/simodo-script/check/061-02-Addition.simodo-script:1:7[1,15]
2593
Интерпретация выполнена успешно
2594
--- test/source/simodo-script/check/061-03-Addition.simodo-script :
2595
def int :
2596
    op1 = 3,
2597
    op2 = 5
2598
print op1 + op2
2599
--- interpret :
2600
Интерпретация выполнена успешно
2601
--- test/source/simodo-script/check/062-01-Subtraction.simodo-script :
2602
print 1 - 2
2603
print 1. - 2
2604
print 1 - 2.
2605
print 1. - 2.
2606
--- interpret :
2607
Интерпретация выполнена успешно
2608
--- test/source/simodo-script/check/062-02-Subtraction.simodo-script :
2609
print "1" - 2
2610
--- interpret :
2611
Ошибка: For operation Subtraction, the use of types string and string is not provided
2612
Позиция разбора: test/source/simodo-script/check/062-02-Subtraction.simodo-script:1:7[1,14]
2613
Интерпретация выполнена успешно
2614
--- test/source/simodo-script/check/063-01-Multiplication.simodo-script :
2615
print 3 * 2
2616
print 3. * 2
2617
print 3 * 2.
2618
print 3. * 2.
2619
--- interpret :
2620
Интерпретация выполнена успешно
2621
--- test/source/simodo-script/check/064-01-Division.simodo-script :
2622
print 3 / 2
2623
print 3. / 2
2624
print 3 / 2.
2625
print 3. / 2.
2626
--- interpret :
2627
Интерпретация выполнена успешно
2628
--- test/source/simodo-script/check/064-02-Division.simodo-script :
2629
print 3 / 0
2630
--- interpret :
2631
Ошибка: Произошло исключение при обработке оператора SBL
2632
Описание исключения: Деление на ноль
2633
Позиция разбора: test/source/simodo-script/check/064-02-Division.simodo-script:1:9[1,10]
2634
Интерпретация прервана
2635
--- test/source/simodo-script/check/064-03-Division.simodo-script :
2636
print 3.0 / 0.0
2637
--- interpret :
2638
Ошибка: Произошло исключение при обработке оператора SBL
2639
Описание исключения: Деление на ноль
2640
Позиция разбора: test/source/simodo-script/check/064-03-Division.simodo-script:1:11[1,12]
2641
Интерпретация прервана
2642
--- test/source/simodo-script/check/065-01-Modulo.simodo-script :
2643
print 3 % 2
2644
--- interpret :
2645
Интерпретация выполнена успешно
2646
--- test/source/simodo-script/check/065-02-Modulo.simodo-script :
2647
#{ built_in_type : 2 } :
2648
    a = 13,
2649
    b = 3
2650

2651
print (a/b)*b + a%b == a
2652
--- interpret :
2653
Интерпретация выполнена успешно
2654
--- test/source/simodo-script/check/066-01-Power.simodo-script :
2655
print 3 ^ 2
2656
print 3.5 ^ 2
2657
print 3.5 ^ 2.
2658
--- interpret :
2659
Интерпретация выполнена успешно
2660
--- test/source/simodo-script/check/072-01-If.simodo-script :
2661
if true
2662
    print "Ok"
2663
print "Done"
2664
--- interpret :
2665
Интерпретация выполнена успешно
2666
--- test/source/simodo-script/check/072-02-If.simodo-script :
2667
if false
2668
    print "Wrong"
2669
print "Done"
2670
--- interpret :
2671
Интерпретация выполнена успешно
2672
--- test/source/simodo-script/check/072-03-If.simodo-script :
2673
if false
2674
    print "Wrong"
2675
else
2676
    print "Ok"
2677
print "Done"
2678
--- interpret :
2679
Интерпретация выполнена успешно
2680
--- test/source/simodo-script/check/072-04-If.simodo-script :
2681
if (true)
2682
    print "Ok"
2683
else
2684
    print "Wrong"
2685
print "Done"
2686
--- interpret :
2687
Интерпретация выполнена успешно
2688
--- test/source/simodo-script/check/072-05-If.simodo-script :
2689
if (false)
2690
    print "Wrong"
2691
else if (true)
2692
    print "Ok"
2693
else
2694
    print "Wrong"
2695
print "Done"
2696
--- interpret :
2697
Интерпретация выполнена успешно
2698
--- test/source/simodo-script/check/081-00-For.simodo-script :
2699
for int : i in [1,2,3]
2700
    print i
2701

2702
print "Done"
2703
--- interpret :
2704
Интерпретация выполнена успешно
2705
--- test/source/simodo-script/check/081-01-For.simodo-script :
2706
#{ initial_value : null } type 
2707
    Range = 
2708
    {
2709
        begin   : 0,
2710
        end     : 0,
2711
        counter : 0,
2712
        __init__ : fn [Range] (int : b, int : e) -> Range
2713
        {
2714
            def Range : range
2715
            
2716
            range.begin = b
2717
            range.end = e
2718
            range.counter = b - 1
2719
            
2720
            return range
2721
        },
2722
        __iterator__ : fn (Range : range)
2723
        {
2724
            range.counter += 1
2725
            return [range.counter, range.counter <= range.end]
2726
        }
2727
    } 
2728

2729
for int : i in Range(1,4)
2730
    print i
2731

2732
print "Done"
2733
--- interpret :
2734
Интерпретация выполнена успешно
2735
--- test/source/simodo-script/check/081-02-For.simodo-script :
2736
def int :
2737
    begin   = 0,
2738
    end     = 0,
2739
    counter = 0
2740
    
2741
def auto :
2742
    __init__ = fn [self] (int : b, int : e) -> auto
2743
        {
2744
            def self : s
2745
        
2746
            s.begin = b
2747
            s.end = e
2748
            s.counter = b - 1
2749
            
2750
            return s
2751
        },
2752
    __iterator__ = fn (self : s) -> auto 
2753
        {
2754
            s.counter += 1
2755
            return [s.counter, s.counter <= s.end]
2756
        }
2757
        --- interpret :
2758
Интерпретация выполнена успешно
2759
--- test/source/simodo-script/check/081-03-For.simodo-script :
2760
import "081-02-For.simodo-script" type range
2761

2762
def range(2,3) : i
2763

2764
print all i
2765

2766
print i.__iterator__(i)
2767
print i.__iterator__(i)
2768
print i.__iterator__(i)
2769

2770
print "Done"
2771
 --- interpret :
2772
Интерпретация выполнена успешно
2773
--- test/source/simodo-script/check/081-04-For.simodo-script :
2774
import "081-02-For.simodo-script" type range
2775

2776
for int : i in range(-1,4)
2777
    print i
2778

2779
print "Done"
2780
--- interpret :
2781
Интерпретация выполнена успешно
2782
--- test/source/simodo-script/check/081-05-For.simodo-script :
2783
def int :
2784
    begin   = 0,
2785
    end     = 0,
2786
    counter = 0
2787
    
2788
def auto :
2789
    __init__ = fn [self] (int : b, int : e) -> auto
2790
        {
2791
            def self : s
2792
        
2793
            s.begin = b
2794
            s.end = e
2795
            s.counter = b - 1
2796
            
2797
            return s
2798
        },
2799
    __iterator__ = fn (self : s) -> auto 
2800
        {
2801
            s.counter += 1
2802
            return s.counter
2803
        }
2804
        --- interpret :
2805
Интерпретация выполнена успешно
2806
--- test/source/simodo-script/check/081-06-For.simodo-script :
2807
import "081-05-For.simodo-script" type range
2808

2809
for int : i in range(-1,4)
2810
    print i
2811

2812
print "Done"
2813
--- interpret :
2814
Ошибка: The iterator of the iteration should return values in the form of a vector in the format: [value, bool : condition]
2815
Позиция разбора: test/source/simodo-script/check/081-06-For.simodo-script:3:16[3,21]
2816
Интерпретация выполнена успешно
2817
--- test/source/simodo-script/check/082-00-While.simodo-script :
2818
def int : i = 1
2819

2820
while i < 5000 
2821
    i += 1
2822

2823
print i
2824
--- interpret :
2825
Интерпретация выполнена успешно
2826
--- test/source/simodo-script/check/082-01-While.simodo-script :
2827
def int : i = 1, count = 0
2828
    
2829
while i < 500 {
2830
    if i % 2 == 0
2831
        count += i
2832
    i += 1
2833
}
2834

2835
print count
2836
--- interpret :
2837
Интерпретация выполнена успешно
2838
--- test/source/simodo-script/check/083-00-DoWhile.simodo-script :
2839
def int : i = -10
2840

2841
do {
2842
    if i > 5000 break
2843
    i += 1
2844
}
2845
while true
2846

2847
print i
2848
--- interpret :
2849
Интерпретация выполнена успешно
2850
--- test/source/simodo-script/check/085-00-Break.simodo-script :
2851
def int : i = 1
2852

2853
while true {
2854
    if i == 4 break
2855
    print i
2856
    i += 1
2857
}
2858

2859
print "Done"
2860
--- interpret :
2861
Интерпретация выполнена успешно
2862
--- test/source/simodo-script/check/085-01-Break.simodo-script :
2863
def int : i = 1
2864

2865
if i == 4 break
2866

2867
print "Done"
2868
--- interpret :
2869
Ошибка: Inappropriate use of the 'break' statement
2870
Позиция разбора: test/source/simodo-script/check/085-01-Break.simodo-script:3:11[3,16]
2871
Интерпретация выполнена успешно
2872
--- test/source/simodo-script/check/085-02-Break.simodo-script :
2873
def int : res;
2874

2875
do
2876
{
2877
    def auto : div = fn (int : x, int : y) -> int
2878
        {
2879
            if y == 0 break
2880
            return x/y 
2881
        }
2882
    
2883
    res =  div(4,0)
2884
}
2885
while res < 0
2886
--- interpret :
2887
Ошибка: Inappropriate use of the 'break' statement
2888
Позиция разбора: test/source/simodo-script/check/085-02-Break.simodo-script:7:23[7,28]
2889
Ошибка: Произошло исключение при обработке оператора SBL
2890
Описание исключения: Деление на ноль
2891
Позиция разбора: test/source/simodo-script/check/085-02-Break.simodo-script:8:21[8,22]
2892
Интерпретация прервана
2893
--- test/source/simodo-script/check/086-00-Continue.simodo-script :
2894
def int : i = -10
2895

2896
do {
2897
    i += 1
2898
    if i < 1 continue
2899
    print i
2900
}
2901
while i < 4
2902

2903
print "Done"
2904
--- interpret :
2905
Интерпретация выполнена успешно
2906
--- test/source/simodo-script/check/086-01-Continue.simodo-script :
2907
def int : i = 1
2908

2909
if i == 4 continue
2910

2911
print "Done"
2912
--- interpret :
2913
Ошибка: Inappropriate use of the 'continue' statement
2914
Позиция разбора: test/source/simodo-script/check/086-01-Continue.simodo-script:3:11[3,19]
2915
Интерпретация выполнена успешно
2916
--- test/source/simodo-script/check/086-02-Continue.simodo-script :
2917
def int : res;
2918

2919
do {
2920
    def auto : div = fn (int : x, int : y) -> int
2921
        {
2922
            if y == 0 continue
2923
            return x/y 
2924
        }
2925
    
2926
    res =  div(4,0)
2927
}
2928
while res < 0
2929
--- interpret :
2930
Ошибка: Inappropriate use of the 'continue' statement
2931
Позиция разбора: test/source/simodo-script/check/086-02-Continue.simodo-script:6:23[6,31]
2932
Ошибка: Произошло исключение при обработке оператора SBL
2933
Описание исключения: Деление на ноль
2934
Позиция разбора: test/source/simodo-script/check/086-02-Continue.simodo-script:7:21[7,22]
2935
Интерпретация прервана
2936
--- test/source/simodo-script/check/110-01-FiberMake.simodo-script :
2937
import "/test/source/simodo-script/import/primes.simodo-script" type Primes : p1
2938

2939
make_fiber p1
2940

2941
flow p1.prime(1,100)
2942

2943
wait p1
2944
 --- interpret :
2945
Интерпретация выполнена успешно
2946
--- test/source/simodo-script/check/110-02-FiberMake.simodo-script :
2947
import "/test/source/simodo-script/import/asynch.simodo-script"
2948
    : async
2949

2950
def auto : factor = fn [factor] (int : x) -> int 
2951
{
2952
    if (x <= 1)
2953
        return 1
2954

2955
    return x*factor(x-1)
2956
}
2957

2958
//auto : f = asynch.future(factor, 10)
2959
def auto : f = async.future( fn [factor] () { return factor(10) } )
2960
def int  : i = factor(10)
2961

2962
print i
2963
print i == f.get()
2964
--- interpret :
2965
Интерпретация выполнена успешно
2966
--- test/source/simodo-script/check/110-03-FiberMake.simodo-script :
2967
import "/test/source/simodo-script/import/primes.simodo-script" type Primes : p1
2968

2969
make_fiber p1
2970

2971
flow p1.prime(1,100)
2972

2973
//wait p1
2974
 --- interpret :
2975
Интерпретация выполнена успешно
2976
--- test/source/simodo-script/check/113-01-FiberPush.simodo-script :
2977
import "/test/source/simodo-script/import/state-pi.simodo-script" type Pi : pi
2978

2979
make_fiber pi
2980

2981
pi.pi = math.pi
2982

2983
flow pi.print_pi()
2984

2985
push pi
2986

2987
flow pi.print_pi()
2988

2989
wait pi
2990
--- interpret :
2991
Интерпретация выполнена успешно
2992
--- test/source/simodo-script/check/114-01-FiberPull.simodo-script :
2993
import "/test/source/simodo-script/import/state-pi.simodo-script" type Pi : pi
2994

2995
make_fiber pi
2996

2997
flow pi.pi_low()
2998

2999
print pi
3000

3001
pull pi
3002

3003
print pi
3004

3005
flow pi.pi_hight()
3006

3007
pull pi
3008

3009
print pi
3010

3011
wait pi
3012
--- interpret :
3013
Интерпретация выполнена успешно
3014

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.