diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/g.stage | 36 | ||||
-rw-r--r-- | tests/i.stage | 17 | ||||
-rw-r--r-- | tests/l.stage | 32 | ||||
-rw-r--r-- | tests/opttest.stage | 18 | ||||
-rw-r--r-- | tests/r.stage | 24 | ||||
-rw-r--r-- | tests/t.stage | 29 | ||||
-rw-r--r-- | tests/test.stage | 35 |
7 files changed, 191 insertions, 0 deletions
diff --git a/tests/g.stage b/tests/g.stage new file mode 100644 index 0000000..05ca5ad --- /dev/null +++ b/tests/g.stage | |||
@@ -0,0 +1,36 @@ | |||
1 | situation <<start>> | ||
2 | { | ||
3 | setup | ||
4 | { | ||
5 | display("pre start"); | ||
6 | a(); | ||
7 | display("post start"); | ||
8 | } | ||
9 | enter | ||
10 | { | ||
11 | display("Start::Enter"); | ||
12 | } | ||
13 | } | ||
14 | |||
15 | function a() | ||
16 | { | ||
17 | display("pre a"); | ||
18 | b(); | ||
19 | display("post a"); | ||
20 | } | ||
21 | |||
22 | function b() | ||
23 | { | ||
24 | display("pre b"); | ||
25 | goto( <<2>> ); | ||
26 | display("post b"); | ||
27 | } | ||
28 | |||
29 | situation <<2>> | ||
30 | { | ||
31 | enter | ||
32 | { | ||
33 | display("pre 2"); | ||
34 | } | ||
35 | } | ||
36 | |||
diff --git a/tests/i.stage b/tests/i.stage new file mode 100644 index 0000000..8c2e7fe --- /dev/null +++ b/tests/i.stage | |||
@@ -0,0 +1,17 @@ | |||
1 | situation <<start>> | ||
2 | { | ||
3 | enter | ||
4 | { | ||
5 | if true then | ||
6 | { | ||
7 | display("True"); | ||
8 | } | ||
9 | else | ||
10 | { | ||
11 | display("False"); | ||
12 | } | ||
13 | |||
14 | display("Done"); | ||
15 | } | ||
16 | } | ||
17 | |||
diff --git a/tests/l.stage b/tests/l.stage new file mode 100644 index 0000000..4c2b8e1 --- /dev/null +++ b/tests/l.stage | |||
@@ -0,0 +1,32 @@ | |||
1 | situation <<start>> | ||
2 | { | ||
3 | enter | ||
4 | { | ||
5 | x = 5; | ||
6 | while x > 0 do | ||
7 | { | ||
8 | display( x ); | ||
9 | x-=1; | ||
10 | } | ||
11 | |||
12 | for each j in [1, 2, 4, 8, 16, 32] do | ||
13 | { | ||
14 | display( j ); | ||
15 | |||
16 | if j == 16 then | ||
17 | { | ||
18 | goto(<<b>>); | ||
19 | } | ||
20 | } | ||
21 | |||
22 | display("Hiya"); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | situation <<b>> | ||
27 | { | ||
28 | enter | ||
29 | { | ||
30 | display("b!"); | ||
31 | } | ||
32 | } | ||
diff --git a/tests/opttest.stage b/tests/opttest.stage new file mode 100644 index 0000000..325a197 --- /dev/null +++ b/tests/opttest.stage | |||
@@ -0,0 +1,18 @@ | |||
1 | option situation <<start>> | ||
2 | { | ||
3 | option: "Begin the game" | ||
4 | { | ||
5 | display("the game has begun."); | ||
6 | } | ||
7 | |||
8 | option: "I'm not ready yet" | ||
9 | { | ||
10 | display("Yup, that's what I thought."); | ||
11 | } | ||
12 | |||
13 | option: "Quit the game" | ||
14 | { | ||
15 | display("Ok...fine..."); | ||
16 | exit(); | ||
17 | } | ||
18 | } | ||
diff --git a/tests/r.stage b/tests/r.stage new file mode 100644 index 0000000..c2d9e1f --- /dev/null +++ b/tests/r.stage | |||
@@ -0,0 +1,24 @@ | |||
1 | |||
2 | game.start = <<a>>; | ||
3 | |||
4 | situation <<a>> | ||
5 | { | ||
6 | setup | ||
7 | { | ||
8 | x = 3; | ||
9 | |||
10 | my_fun( x ); | ||
11 | |||
12 | display("About to end" + x); | ||
13 | |||
14 | exit(); | ||
15 | } | ||
16 | } | ||
17 | |||
18 | function my_fun( a ) | ||
19 | { | ||
20 | display( a ); | ||
21 | return(); | ||
22 | display( "hello" ); | ||
23 | } | ||
24 | |||
diff --git a/tests/t.stage b/tests/t.stage new file mode 100644 index 0000000..c97fe4f --- /dev/null +++ b/tests/t.stage | |||
@@ -0,0 +1,29 @@ | |||
1 | |||
2 | situation <<start>> | ||
3 | { | ||
4 | setup | ||
5 | { | ||
6 | display("Hi"); | ||
7 | } | ||
8 | enter | ||
9 | { | ||
10 | display("start pre"); | ||
11 | goAhead(); | ||
12 | display("start post"); | ||
13 | } | ||
14 | } | ||
15 | |||
16 | function goAhead() | ||
17 | { | ||
18 | display("goAhead() pre"); | ||
19 | goto( <<next>> ); | ||
20 | display("goAhead() post"); | ||
21 | } | ||
22 | |||
23 | situation <<next>> | ||
24 | { | ||
25 | enter | ||
26 | { | ||
27 | display("This is next."); | ||
28 | } | ||
29 | } | ||
diff --git a/tests/test.stage b/tests/test.stage new file mode 100644 index 0000000..cc765a4 --- /dev/null +++ b/tests/test.stage | |||
@@ -0,0 +1,35 @@ | |||
1 | |||
2 | game.title = "Code Test"; | ||
3 | game.author = "Mike Buland"; | ||
4 | game.version = 1; | ||
5 | game.revision = 0; | ||
6 | game.start = <<start>>; | ||
7 | |||
8 | global | ||
9 | { | ||
10 | command: "exit" | ||
11 | { | ||
12 | exit(); | ||
13 | } | ||
14 | } | ||
15 | |||
16 | function getVal() | ||
17 | { | ||
18 | global.stuff = {'hi': 5 }; | ||
19 | } | ||
20 | |||
21 | situation <<start>> | ||
22 | { | ||
23 | setup | ||
24 | { | ||
25 | if true then | ||
26 | { | ||
27 | getVal(); | ||
28 | } | ||
29 | } | ||
30 | |||
31 | enter | ||
32 | { | ||
33 | } | ||
34 | } | ||
35 | |||