Skip to content

Commit b9f31df

Browse files
committed
Add CppExecutionContext test
1 parent a2bff34 commit b9f31df

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎src/engine/internal/codegen/cpp/cppcompilercontext.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44

55
#include <scratchcpp/compilercontext.h>
66

7+
#include "test_export.h"
8+
79
namespace libscratchcpp
810
{
911

10-
class CppCompilerContext : public CompilerContext
12+
class LIBSCRATCHCPP_TEST_EXPORT CppCompilerContext : public CompilerContext
1113
{
1214
public:
1315
CppCompilerContext(IEngine *engine, Target *target, const std::unordered_set<std::string> &unsafeConstants = {});

‎src/engine/internal/codegen/cpp/cppexecutioncontext.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44

55
#include <scratchcpp/executioncontext.h>
66

7+
#include "test_export.h"
8+
79
namespace libscratchcpp
810
{
911

1012
class CppCompilerContext;
1113

12-
class CppExecutionContext : public ExecutionContext
14+
class LIBSCRATCHCPP_TEST_EXPORT CppExecutionContext : public ExecutionContext
1315
{
1416
public:
1517
CppExecutionContext(CppCompilerContext *ctx, Thread *thread);

‎test/cpp/CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_executable(
22
cpp_test
33
main.cpp
4+
cppexecutioncontext_test.cpp
45
)
56

67
target_link_libraries(
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <scratchcpp/thread.h>
2+
#include <engine/internal/codegen/cpp/cppexecutioncontext.h>
3+
#include <engine/internal/codegen/cpp/cppcompilercontext.h>
4+
#include <gtest/gtest.h>
5+
6+
using namespace libscratchcpp;
7+
8+
TEST(CppExecutionContextTest, Constructor)
9+
{
10+
Thread thread(nullptr, nullptr, nullptr);
11+
CppCompilerContext compilerCtx(nullptr, nullptr);
12+
CppExecutionContext ctx(&compilerCtx, &thread);
13+
ASSERT_EQ(ctx.thread(), &thread);
14+
}

0 commit comments

Comments
 (0)