From a859a39f3455fcbf0575bd7acd25915c40922f92 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 8 Feb 2012 00:24:06 -0700 Subject: Committed the tests I've been using. Good for regressions, I'll have to make some sort of test suite thing later. --- opttest.stage | 18 ------------------ test.stage | 35 ----------------------------------- tests/g.stage | 36 ++++++++++++++++++++++++++++++++++++ tests/i.stage | 17 +++++++++++++++++ tests/l.stage | 32 ++++++++++++++++++++++++++++++++ tests/opttest.stage | 18 ++++++++++++++++++ tests/r.stage | 24 ++++++++++++++++++++++++ tests/t.stage | 29 +++++++++++++++++++++++++++++ tests/test.stage | 35 +++++++++++++++++++++++++++++++++++ 9 files changed, 191 insertions(+), 53 deletions(-) delete mode 100644 opttest.stage delete mode 100644 test.stage create mode 100644 tests/g.stage create mode 100644 tests/i.stage create mode 100644 tests/l.stage create mode 100644 tests/opttest.stage create mode 100644 tests/r.stage create mode 100644 tests/t.stage create mode 100644 tests/test.stage diff --git a/opttest.stage b/opttest.stage deleted file mode 100644 index 325a197..0000000 --- a/opttest.stage +++ /dev/null @@ -1,18 +0,0 @@ -option situation <> -{ - option: "Begin the game" - { - display("the game has begun."); - } - - option: "I'm not ready yet" - { - display("Yup, that's what I thought."); - } - - option: "Quit the game" - { - display("Ok...fine..."); - exit(); - } -} diff --git a/test.stage b/test.stage deleted file mode 100644 index cc765a4..0000000 --- a/test.stage +++ /dev/null @@ -1,35 +0,0 @@ - -game.title = "Code Test"; -game.author = "Mike Buland"; -game.version = 1; -game.revision = 0; -game.start = <>; - -global -{ - command: "exit" - { - exit(); - } -} - -function getVal() -{ - global.stuff = {'hi': 5 }; -} - -situation <> -{ - setup - { - if true then - { - getVal(); - } - } - - enter - { - } -} - 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 @@ +situation <> +{ + setup + { + display("pre start"); + a(); + display("post start"); + } + enter + { + display("Start::Enter"); + } +} + +function a() +{ + display("pre a"); + b(); + display("post a"); +} + +function b() +{ + display("pre b"); + goto( <<2>> ); + display("post b"); +} + +situation <<2>> +{ + enter + { + display("pre 2"); + } +} + 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 @@ +situation <> +{ + enter + { + if true then + { + display("True"); + } + else + { + display("False"); + } + + display("Done"); + } +} + 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 @@ +situation <> +{ + enter + { + x = 5; + while x > 0 do + { + display( x ); + x-=1; + } + + for each j in [1, 2, 4, 8, 16, 32] do + { + display( j ); + + if j == 16 then + { + goto(<>); + } + } + + display("Hiya"); + } +} + +situation <> +{ + enter + { + display("b!"); + } +} 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 @@ +option situation <> +{ + option: "Begin the game" + { + display("the game has begun."); + } + + option: "I'm not ready yet" + { + display("Yup, that's what I thought."); + } + + option: "Quit the game" + { + display("Ok...fine..."); + exit(); + } +} 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 @@ + +game.start = <>; + +situation <> +{ + setup + { + x = 3; + + my_fun( x ); + + display("About to end" + x); + + exit(); + } +} + +function my_fun( a ) +{ + display( a ); + return(); + display( "hello" ); +} + 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 @@ + +situation <> +{ + setup + { + display("Hi"); + } + enter + { + display("start pre"); + goAhead(); + display("start post"); + } +} + +function goAhead() +{ + display("goAhead() pre"); + goto( <> ); + display("goAhead() post"); +} + +situation <> +{ + enter + { + display("This is next."); + } +} 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 @@ + +game.title = "Code Test"; +game.author = "Mike Buland"; +game.version = 1; +game.revision = 0; +game.start = <>; + +global +{ + command: "exit" + { + exit(); + } +} + +function getVal() +{ + global.stuff = {'hi': 5 }; +} + +situation <> +{ + setup + { + if true then + { + getVal(); + } + } + + enter + { + } +} + -- cgit v1.2.3