-
-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathNoEarlyTags.cpp
More file actions
40 lines (36 loc) · 1.2 KB
/
NoEarlyTags.cpp
File metadata and controls
40 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "catch.hpp"
#include <compiler.h>
#include <globals.h>
#include <runner.h>
#include <story.h>
using namespace ink::runtime;
std::unique_ptr<story> tg_ink{story::from_file(INK_TEST_RESOURCE_DIR "NoEarlyTags.bin")};
auto tg_thread = tg_ink->new_runner();
SCENARIO("Story with tags and glues", "[tags][glue]")
{
GIVEN("lines intersected with tags and glue")
{
WHEN("no glue")
{
CHECK(tg_thread->getline() == "Hey there, nice to meet you!\n");
REQUIRE(tg_thread->num_tags() == 2);
CHECK(std::string(tg_thread->get_tag(0)) == "name fae03_name");
CHECK(std::string(tg_thread->get_tag(1)) == "bb CaoimheGenericProgress");
}
WHEN("next line")
{
CHECK(tg_thread->getline() == "Hey, I'm Hey and this is YOU, nice to meet you too!\n");
REQUIRE(tg_thread->num_tags() == 1);
CHECK(std::string(tg_thread->get_tag(0)) == "name fae00_name");
}
WHEN("glue stops tags lookahead")
{
CHECK(
tg_thread->getline() == "I'm Do! Most people can't pronounce it, just think 'Kee-vah\".\n"
);
REQUIRE(tg_thread->num_tags() == 2);
CHECK(std::string(tg_thread->get_tag(0)) == "name fae03_name");
CHECK(std::string(tg_thread->get_tag(1)) == "meet-character 5");
}
}
}