|
0 |
Tests for Unlikely
|
|
1 |
==================
|
|
2 |
|
|
3 |
-> Tests for functionality "Parse Unlikely Program"
|
|
4 |
|
|
5 |
-> Functionality "Parse Unlikely Program" is implemented by
|
|
6 |
-> shell command
|
|
7 |
-> "python src/coldwater.py %(test-body-file)"
|
|
8 |
|
|
9 |
Here is a syntactically correct program.
|
|
10 |
|
|
11 |
| class Count(Count,Chain,Print,Add) extends Continuation
|
|
12 |
|
|
|
13 |
| class CountForever(Count,Chain,Print,Add) extends Program {
|
|
14 |
| Count c;
|
|
15 |
| method continue(Passive accumulator) {
|
|
16 |
| c = new Count(Passive,Count,Chain,Print,Add);
|
|
17 |
| goto c.continue(new 1(Passive));
|
|
18 |
| }
|
|
19 |
| }
|
|
20 |
|
|
|
21 |
| class Count() extends Continuation {
|
|
22 |
| Count c;
|
|
23 |
| Print p;
|
|
24 |
| Add a;
|
|
25 |
| method continue(Passive accumulator) {
|
|
26 |
| c = new Count(Passive,Count,Chain,Print,Add);
|
|
27 |
| a = new Add(Passive,Chain);
|
|
28 |
| a.value = new 1(Passive);
|
|
29 |
| a.next = c;
|
|
30 |
| p = new Print(Passive,Chain);
|
|
31 |
| p.next = a;
|
|
32 |
| goto p.continue(accumulator);
|
|
33 |
| }
|
|
34 |
| }
|
|
35 |
|
|
|
36 |
=
|
|
37 |
|
|
38 |
And here is one which is not syntactically correct.
|
|
39 |
|
|
40 |
| class Hello(Print,Chain,Stop) extends Program {
|
|
41 |
| Print p;
|
|
42 |
| method continue(accumulator) {
|
|
43 |
| p = new Print(Passive,Chain);
|
|
44 |
| p.next = new Stop(Passive);
|
|
45 |
| goto p.continue(new "Hello, world!"(Passive));
|
|
46 |
| }
|
|
47 |
| }
|
|
48 |
? ArtefactNotFoundError
|