-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
126 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
#include "catch.hpp" | ||
#include "../inkcpp_cl/test.h" | ||
|
||
#include <story.h> | ||
#include <globals.h> | ||
#include <runner.h> | ||
#include <compiler.h> | ||
|
||
using namespace ink::runtime; | ||
|
||
SCENARIO("a story with bracketed choices and spaces can choose correctly", "[choices]") | ||
{ | ||
GIVEN("a story with line breaks") | ||
{ | ||
inklecate("ink/ChoiceBracketStory.ink", "ChoiceBracketStory.tmp"); | ||
ink::compiler::run("ChoiceBracketStory.tmp", "ChoiceBracketStory.bin"); | ||
auto ink = story::from_file("ChoiceBracketStory.bin"); | ||
runner thread = ink->new_runner(); | ||
thread->getall(); | ||
WHEN("start thread") | ||
{ | ||
THEN("thread has choices") | ||
{ | ||
thread->getall(); | ||
REQUIRE(thread->has_choices()); | ||
} | ||
WHEN("choose choice 1") | ||
{ | ||
thread->choose(0); | ||
thread->getall(); | ||
THEN("still has choices") | ||
{ | ||
thread->getall(); | ||
REQUIRE(thread->has_choices()); | ||
} | ||
} | ||
WHEN("choose choice 2") | ||
{ | ||
thread->choose(1); | ||
thread->getall(); | ||
THEN("still has choices") | ||
{ | ||
REQUIRE(thread->has_choices()); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
#include "catch.hpp" | ||
#include "../inkcpp_cl/test.h" | ||
|
||
#include <story.h> | ||
#include <globals.h> | ||
#include <runner.h> | ||
#include <compiler.h> | ||
|
||
using namespace ink::runtime; | ||
|
||
SCENARIO("a story with bracketed choices and spaces can choose correctly", "[choices]") | ||
{ | ||
GIVEN("a story with line breaks") | ||
{ | ||
inklecate("ink/ChoiceBracketStory.ink", "ChoiceBracketStory.tmp"); | ||
ink::compiler::run("ChoiceBracketStory.tmp", "ChoiceBracketStory.bin"); | ||
auto ink = story::from_file("ChoiceBracketStory.bin"); | ||
runner thread = ink->new_runner(); | ||
thread->getall(); | ||
WHEN("start thread") | ||
{ | ||
THEN("thread has choices") | ||
{ | ||
thread->getall(); | ||
REQUIRE(thread->has_choices()); | ||
} | ||
WHEN("choose choice 1") | ||
{ | ||
thread->choose(0); | ||
thread->getall(); | ||
THEN("still has choices") | ||
{ | ||
thread->getall(); | ||
REQUIRE(thread->has_choices()); | ||
} | ||
} | ||
WHEN("choose choice 2") | ||
{ | ||
thread->choose(1); | ||
thread->getall(); | ||
THEN("still has choices") | ||
{ | ||
REQUIRE(thread->has_choices()); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
#include "catch.hpp" | ||
#include "../inkcpp_cl/test.h" | ||
|
||
#include <story.h> | ||
#include <globals.h> | ||
#include <runner.h> | ||
#include <compiler.h> | ||
|
||
using namespace ink::runtime; | ||
|
||
SCENARIO("a story with a bracketed choice as a second choice, and then a third choice, chooses properly", "[choices]") | ||
{ | ||
GIVEN("a story with brackets and nested choices") | ||
{ | ||
inklecate("ink/ThirdTierChoiceAfterBracketsStory.ink", "ThirdTierChoiceAfterBracketsStory.tmp"); | ||
ink::compiler::run("ThirdTierChoiceAfterBracketsStory.tmp", "ThirdTierChoiceAfterBracketsStory.bin"); | ||
auto ink = story::from_file("ThirdTierChoiceAfterBracketsStory.bin"); | ||
runner thread = ink->new_runner(); | ||
|
||
WHEN("start thread") | ||
{ | ||
THEN("thread doesn't error") | ||
{ | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
} | ||
} | ||
} | ||
} | ||
#include "catch.hpp" | ||
#include "../inkcpp_cl/test.h" | ||
|
||
#include <story.h> | ||
#include <globals.h> | ||
#include <runner.h> | ||
#include <compiler.h> | ||
|
||
using namespace ink::runtime; | ||
|
||
SCENARIO( | ||
"a story with a bracketed choice as a second choice, and then a third choice, chooses properly", | ||
"[choices]" | ||
) | ||
{ | ||
GIVEN("a story with brackets and nested choices") | ||
{ | ||
inklecate("ink/ThirdTierChoiceAfterBracketsStory.ink", "ThirdTierChoiceAfterBracketsStory.tmp"); | ||
ink::compiler::run( | ||
"ThirdTierChoiceAfterBracketsStory.tmp", "ThirdTierChoiceAfterBracketsStory.bin" | ||
); | ||
auto ink = story::from_file("ThirdTierChoiceAfterBracketsStory.bin"); | ||
runner thread = ink->new_runner(); | ||
|
||
WHEN("start thread") | ||
{ | ||
THEN("thread doesn't error") | ||
{ | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
thread->choose(0); | ||
thread->getall(); | ||
thread->has_choices(); | ||
} | ||
} | ||
} | ||
} |