Sha256: f9bba158eceb5dd2a342e69047b3950b7c895afdbe7b59757f4a8fcdf30cf65d

Contents?: true

Size: 776 Bytes

Versions: 4

Compression:

Stored size: 776 Bytes

Contents

#include "catch.hpp"

#include <story.h>
#include <globals.h>
#include <runner.h>
#include <compiler.h>

using namespace ink::runtime;

SCENARIO("a story with an external function evaluates the function at the right time", "[story]")
{
	GIVEN("a story with an external function")
	{
		auto   ink    = story::from_file(INK_TEST_RESOURCE_DIR "ExternalFunctionsExecuteProperly.bin");
		runner thread = ink->new_runner();

		int line_count = 0;


		thread->bind("GET_LINE_COUNT", [&line_count]() { return line_count; });

		WHEN("run thread")
		{
			THEN("thread has correct line counts")
			{
				while (thread->can_continue()) {
					auto line = thread->getline();
					REQUIRE(line == "Line count: " + std::to_string(line_count) + "\n");
					line_count++;
				}
			}
		}
	}
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inkcpp_rb-0.1.3 ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp
inkcpp_rb-0.1.2 ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp
inkcpp_rb-0.1.1 ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp
inkcpp_rb-0.1.0 ext/inkcpp_rb/inkcpp/inkcpp_test/ExternalFunctionsExecuteProperly.cpp