APP: split core and app module
parent
3e0e08eecd
commit
f89a730547
|
@ -22,6 +22,7 @@ jobs:
|
|||
run: |
|
||||
cd build
|
||||
ctest -V -R tests-animation$
|
||||
ctest -V -R tests-app$
|
||||
ctest -V -R tests-attrib$
|
||||
ctest -V -R tests-computeshadertool$
|
||||
ctest -V -R tests-cooldown$
|
||||
|
@ -95,6 +96,7 @@ jobs:
|
|||
run: |
|
||||
cd build
|
||||
ctest -V -R tests-animation$
|
||||
ctest -V -R tests-app$
|
||||
ctest -V -R tests-attrib$
|
||||
ctest -V -R tests-computeshadertool$
|
||||
ctest -V -R tests-cooldown$
|
||||
|
@ -152,6 +154,7 @@ jobs:
|
|||
run: |
|
||||
cd build
|
||||
ctest -V -C Release -R tests-animation$
|
||||
ctest -V -C Release -R tests-app$
|
||||
ctest -V -C Release -R tests-attrib$
|
||||
ctest -V -C Release -R tests-computeshadertool$
|
||||
ctest -V -C Release -R tests-cooldown$
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
"Pâöâ€U"
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include "ClientPager.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "http/ResponseParser.h"
|
||||
#include "http/HttpMimeType.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ if (COMPILER_SUPPORTS_WDOCUMENTATION)
|
|||
endif()
|
||||
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(app)
|
||||
add_subdirectory(uuid)
|
||||
add_subdirectory(console)
|
||||
add_subdirectory(http)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "AnimationEntity.h"
|
||||
#include "animation/LUAAnimation.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include <float.h>
|
||||
|
||||
|
|
|
@ -140,16 +140,15 @@ set(TEST_SRCS
|
|||
)
|
||||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
||||
set(BENCHMARK_SRCS
|
||||
../core/benchmark/AbstractBenchmark.cpp
|
||||
benchmarks/AnimationBenchmark.cpp
|
||||
)
|
||||
engine_add_executable(TARGET benchmarks-${LIB} SRCS ${BENCHMARK_SRCS} NOINSTALL)
|
||||
engine_target_link_libraries(TARGET benchmarks-${LIB} DEPENDENCIES benchmark ${LIB})
|
||||
engine_target_link_libraries(TARGET benchmarks-${LIB} DEPENDENCIES benchmark-app ${LIB})
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "core/benchmark/AbstractBenchmark.h"
|
||||
#include "app/benchmark/AbstractBenchmark.h"
|
||||
#include "animation/chr/anim/Glide.h"
|
||||
#include "animation/chr/anim/Idle.h"
|
||||
#include "animation/chr/anim/Jump.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "animation/AnimationSettings.h"
|
||||
#include "animation/chr/CharacterSkeletonAttribute.h"
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "animation/SkeletonAttribute.h"
|
||||
#include "animation/chr/CharacterSkeleton.h"
|
||||
#include "animation/chr/CharacterSkeletonAttribute.h"
|
||||
#include "core/App.h"
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/App.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "animation/LUAAnimation.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "animation/chr/CharacterSkeleton.h"
|
||||
#include "animation/AnimationSettings.h"
|
||||
#include "animation/BoneId.h"
|
||||
|
|
|
@ -3,18 +3,18 @@
|
|||
*/
|
||||
|
||||
#include "App.h"
|
||||
#include "AppCommand.h"
|
||||
#include "Var.h"
|
||||
#include "app/AppCommand.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/concurrent/ThreadPool.h"
|
||||
#include "command/Command.h"
|
||||
#include "command/CommandHandler.h"
|
||||
#include "io/Filesystem.h"
|
||||
#include "Common.h"
|
||||
#include "EventBus.h"
|
||||
#include "metric/Metric.h"
|
||||
#include "metric/UDPMetricSender.h"
|
||||
#include "Log.h"
|
||||
#include "Tokenizer.h"
|
||||
#include "core/command/Command.h"
|
||||
#include "core/command/CommandHandler.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/EventBus.h"
|
||||
#include "core/metric/Metric.h"
|
||||
#include "core/metric/UDPMetricSender.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/Tokenizer.h"
|
||||
#include "core/concurrent/Concurrency.h"
|
||||
#include "util/VarUtil.h"
|
||||
#include <SDL.h>
|
||||
|
@ -686,16 +686,8 @@ const core::String& App::currentWorkingDir() const {
|
|||
return _filesystem->basePath();
|
||||
}
|
||||
|
||||
BindingContext App::setBindingContext(BindingContext newContext) {
|
||||
if (_bindingContext == newContext) {
|
||||
return newContext;
|
||||
}
|
||||
std::swap(_bindingContext, newContext);
|
||||
Log::debug("Set the input context to %i (from %i)", (int)_bindingContext, (int)newContext);
|
||||
return newContext;
|
||||
}
|
||||
|
||||
core::ThreadPool& App::threadPool() {
|
||||
return *_threadPool.get();
|
||||
}
|
||||
|
||||
}
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "Trace.h"
|
||||
#include "BindingContext.h"
|
||||
#include "String.h"
|
||||
#include "collection/List.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/Trace.h"
|
||||
#include "core/BindingContext.h"
|
||||
#include "core/String.h"
|
||||
#include "core/collection/List.h"
|
||||
#include "core/concurrent/Atomic.h"
|
||||
#include "core/SharedPtr.h"
|
||||
#include <memory>
|
||||
|
@ -73,8 +73,6 @@ protected:
|
|||
core::String _organisation;
|
||||
core::String _appname;
|
||||
|
||||
BindingContext _bindingContext = BindingContext::All;
|
||||
|
||||
AppState _curState = AppState::Construct;
|
||||
AppState _nextState = AppState::InvalidAppState;
|
||||
bool _blockers[(int)AppState::Max] { false, false, false, false, false, false, false, false, false };
|
||||
|
@ -278,20 +276,6 @@ public:
|
|||
|
||||
const core::String& currentWorkingDir() const;
|
||||
|
||||
/**
|
||||
* @brief Allows to change the binding context. This can be used to e.g. ignore some commands while hovering
|
||||
* the ui and they should only be active if the scene has the focus.
|
||||
* @return the old context
|
||||
* @sa bindingContext()
|
||||
*/
|
||||
BindingContext setBindingContext(BindingContext newInputContext);
|
||||
|
||||
/**
|
||||
* @brief Get the current binding context
|
||||
* @sa setBindingContext() for more details.
|
||||
*/
|
||||
BindingContext bindingContext() const;
|
||||
|
||||
static App* getInstance();
|
||||
|
||||
private:
|
||||
|
@ -326,10 +310,6 @@ inline const core::String& App::appname() const {
|
|||
return _appname;
|
||||
}
|
||||
|
||||
inline BindingContext App::bindingContext() const {
|
||||
return _bindingContext;
|
||||
}
|
||||
|
||||
inline AppState App::state() const {
|
||||
return _curState;
|
||||
}
|
|
@ -3,12 +3,12 @@
|
|||
*/
|
||||
|
||||
#include "AppCommand.h"
|
||||
#include "command/Command.h"
|
||||
#include "core/command/Command.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "util/VarUtil.h"
|
||||
#include "App.h"
|
||||
#include "Log.h"
|
||||
#include "Var.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/Var.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace core {
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "TimeProvider.h"
|
||||
#include "core/TimeProvider.h"
|
||||
|
||||
namespace core {
|
||||
namespace AppCommand {
|
|
@ -0,0 +1,48 @@
|
|||
set(SRCS
|
||||
App.cpp App.h
|
||||
AppCommand.cpp AppCommand.h
|
||||
CommandlineApp.h CommandlineApp.cpp
|
||||
)
|
||||
|
||||
set(LIB app)
|
||||
|
||||
if (WINDOWS)
|
||||
# All this windows.h insanities ... giving up on this module
|
||||
set_property(GLOBAL PROPERTY ${LIB}_NOUNITY TRUE)
|
||||
endif()
|
||||
|
||||
set(LIBS sdl2 glm libuv backward)
|
||||
engine_add_module(TARGET ${LIB} SRCS ${SRCS} DEPENDENCIES ${LIBS} core)
|
||||
|
||||
set(TEST_MODULE_SRCS
|
||||
tests/AbstractTest.cpp
|
||||
tests/AbstractTest.h
|
||||
)
|
||||
engine_add_module(TARGET test-${LIB} SRCS ${TEST_MODULE_SRCS} DEPENDENCIES gtest ${LIB})
|
||||
|
||||
set(TEST_FILES
|
||||
testapp/iotest.txt
|
||||
)
|
||||
|
||||
set(TEST_SRCS
|
||||
tests/AppTest.cpp
|
||||
tests/CommandCompleterTest.cpp
|
||||
tests/FilesystemTest.cpp
|
||||
tests/FileStreamTest.cpp
|
||||
tests/FileTest.cpp
|
||||
)
|
||||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
gtest_suite_files(tests ${TEST_FILES})
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_files(tests-${LIB} ${TEST_FILES})
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
||||
set(BENCHMARK_SRCS
|
||||
benchmark/AbstractBenchmark.cpp
|
||||
)
|
||||
engine_add_module(TARGET benchmark-${LIB} SRCS ${BENCHMARK_SRCS} DEPENDENCIES benchmark ${LIB})
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/TimeProvider.h"
|
||||
#include "core/EventBus.h"
|
||||
#include "core/metric/Metric.h"
|
|
@ -5,7 +5,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <benchmark/benchmark.h>
|
||||
#include "core/CommandlineApp.h"
|
||||
#include "app/CommandlineApp.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/EventBus.h"
|
||||
#include "core/TimeProvider.h"
|
|
@ -16,7 +16,7 @@ extern int _argc;
|
|||
|
||||
namespace core {
|
||||
|
||||
core::String AbstractTest::toString(const core::String& filename) const {
|
||||
core::String AbstractTest::fileToString(const core::String& filename) const {
|
||||
const io::FilesystemPtr& fs = _testApp->filesystem();
|
||||
const io::FilePtr& file = fs->open(filename);
|
||||
if (!file->exists()) {
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/tests/TestHelper.h"
|
||||
#include "app/CommandlineApp.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class AbstractTest: public testing::Test {
|
||||
private:
|
||||
class TestApp: public core::CommandlineApp {
|
||||
friend class AbstractTest;
|
||||
private:
|
||||
using Super = core::CommandlineApp;
|
||||
protected:
|
||||
AbstractTest* _test = nullptr;
|
||||
public:
|
||||
TestApp(const metric::MetricPtr& metric, const io::FilesystemPtr& filesystem, const core::EventBusPtr& eventBus, const core::TimeProviderPtr& timeProvider, AbstractTest* test);
|
||||
virtual ~TestApp();
|
||||
|
||||
core::AppState onInit() override;
|
||||
core::AppState onCleanup() override;
|
||||
};
|
||||
|
||||
protected:
|
||||
TestApp *_testApp = nullptr;
|
||||
|
||||
core::String fileToString(const core::String& filename) const;
|
||||
|
||||
virtual void onCleanupApp() {
|
||||
}
|
||||
|
||||
virtual bool onInitApp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
virtual void TearDown() override;
|
||||
};
|
||||
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/metric/Metric.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/EventBus.h"
|
||||
|
@ -41,4 +41,4 @@ TEST(AppTest, testLifecycleOnFrame) {
|
|||
ASSERT_EQ(core::AppState::InvalidAppState, app.state());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -2,13 +2,14 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/command/CommandCompleter.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/tests/TestHelper.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class CommandCompleterTest: public AbstractTest {
|
||||
class CommandCompleterTest: public core::AbstractTest {
|
||||
public:
|
||||
bool onInitApp() override{
|
||||
const io::FilesystemPtr& fs = io::filesystem();
|
||||
|
@ -27,7 +28,7 @@ public:
|
|||
};
|
||||
|
||||
TEST_F(CommandCompleterTest, testComplete) {
|
||||
auto func = fileCompleter("commandcompletertest/", "*.foo");
|
||||
auto func = fileCompleter(io::filesystem(), "commandcompletertest/", "*.foo");
|
||||
core::DynamicArray<core::String> matches;
|
||||
ASSERT_EQ(5, func("", matches)) << toString(matches);
|
||||
EXPECT_EQ("dir1/", matches[0]) << toString(matches);
|
||||
|
@ -38,7 +39,7 @@ TEST_F(CommandCompleterTest, testComplete) {
|
|||
}
|
||||
|
||||
TEST_F(CommandCompleterTest, testCompleteOnlyFiles) {
|
||||
auto func = fileCompleter("commandcompletertest/", "*.foo");
|
||||
auto func = fileCompleter(io::filesystem(), "commandcompletertest/", "*.foo");
|
||||
core::DynamicArray<core::String> matches;
|
||||
ASSERT_EQ(4, func("f", matches)) << toString(matches);
|
||||
EXPECT_EQ("foo1.foo", matches[0]) << toString(matches);
|
||||
|
@ -48,21 +49,21 @@ TEST_F(CommandCompleterTest, testCompleteOnlyFiles) {
|
|||
}
|
||||
|
||||
TEST_F(CommandCompleterTest, testCompleteSubdir) {
|
||||
auto func = fileCompleter("commandcompletertest/", "*.foo");
|
||||
auto func = fileCompleter(io::filesystem(), "commandcompletertest/", "*.foo");
|
||||
core::DynamicArray<core::String> matches;
|
||||
ASSERT_EQ(1, func("dir1", matches)) << toString(matches);
|
||||
EXPECT_EQ("dir1/", matches[0]) << toString(matches);
|
||||
}
|
||||
|
||||
TEST_F(CommandCompleterTest, testCompleteSubdirFile) {
|
||||
auto func = fileCompleter("commandcompletertest/dir1/", "*.foo");
|
||||
auto func = fileCompleter(io::filesystem(), "commandcompletertest/dir1/", "*.foo");
|
||||
core::DynamicArray<core::String> matches;
|
||||
ASSERT_EQ(1, func("f", matches)) << toString(matches);
|
||||
EXPECT_EQ("foo1.foo", matches[0]) << toString(matches);
|
||||
}
|
||||
|
||||
TEST_F(CommandCompleterTest, testCompleteSubdirFile2) {
|
||||
auto func = fileCompleter("commandcompletertest/", "*.foo");
|
||||
auto func = fileCompleter(io::filesystem(), "commandcompletertest/", "*.foo");
|
||||
core::DynamicArray<core::String> matches;
|
||||
ASSERT_EQ(1, func("dir1/f", matches)) << toString(matches);
|
||||
EXPECT_EQ("dir1/foo1.foo", matches[0]) << toString(matches);
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/io/FileStream.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/FourCC.h"
|
|
@ -1,4 +1,4 @@
|
|||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/StringUtil.h"
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/Enum.h"
|
||||
#include "core/Algorithm.h"
|
|
@ -16,9 +16,9 @@ set(TEST_SRCS
|
|||
tests/ContainerProviderTest.cpp
|
||||
)
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} image)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} image test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "attrib/Attributes.h"
|
||||
|
||||
namespace attrib {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "Shared_generated.h"
|
||||
#include "attrib/Container.h"
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "attrib/ContainerProvider.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
|
|
|
@ -229,10 +229,10 @@ set(TEST_SRCS
|
|||
)
|
||||
gtest_suite_files(tests ${TEST_FILES})
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_files(tests-${LIB} ${TEST_FILES})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "attrib/ContainerProvider.h"
|
||||
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
|
||||
namespace backend {
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "core/command/Command.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "core/Password.h"
|
||||
#include "cooldown/CooldownProvider.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/EventBus.h"
|
||||
#include "core/Password.h"
|
||||
#include "ServerMessages_generated.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "backend/entity/ai/AIRegistry.h"
|
||||
#include "backend/world/MapProvider.h"
|
||||
#include "backend/world/Map.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "backend/world/MapProvider.h"
|
||||
#include "network/ProtocolHandlerRegistry.h"
|
||||
#include "network/ServerNetwork.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "backend/world/Map.h"
|
||||
#include "network/ProtocolHandlerRegistry.h"
|
||||
#include "network/ServerNetwork.h"
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "backend/entity/ai/LUAAIRegistry.h"
|
||||
#include "backend/entity/ai/aggro/AggroMgr.h"
|
||||
#include "backend/entity/ai/group/GroupMgr.h"
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "TestEntity.h"
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "backend/world/World.h"
|
||||
#include "backend/world/MapProvider.h"
|
||||
#include "network/ProtocolHandlerRegistry.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "voxelworld/WorldMgr.h"
|
||||
#include "core/StringUtil.h"
|
||||
#include "core/EventBus.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Trace.h"
|
||||
#include "math/QuadTree.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
|
|
@ -11,9 +11,9 @@ set(TEST_SRCS
|
|||
)
|
||||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "core/command/CommandHandler.h"
|
||||
#include "core/String.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
void clua_assert(lua_State* s, bool pass, const char *msg) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "commonlua/LUAFunctions.h"
|
||||
|
||||
namespace lua {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "Shader.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Assert.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/StringUtil.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
#include "CLCompute.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/StringUtil.h"
|
||||
#include "core/Assert.h"
|
||||
#include "core/StandardLib.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "TestsComputeShaders.h"
|
||||
|
||||
namespace compute {
|
||||
|
|
|
@ -5,7 +5,7 @@ set(SRCS
|
|||
)
|
||||
set(LIB console)
|
||||
|
||||
set(LIBS util)
|
||||
set(LIBS util app)
|
||||
|
||||
if (CURSES_FOUND)
|
||||
list(APPEND LIBS ${CURSES_LIBRARIES})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/CommandlineApp.h"
|
||||
#include "app/CommandlineApp.h"
|
||||
#include "CursesConsole.h"
|
||||
|
||||
namespace console {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include "CursesConsole.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/GameConfig.h"
|
||||
#include <SDL_stdinc.h>
|
||||
|
|
|
@ -16,9 +16,9 @@ set(TEST_SRCS
|
|||
tests/CooldownMgrTest.cpp
|
||||
)
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} image)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app image)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "CooldownProvider.h"
|
||||
|
||||
#include "commonlua/LUA.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/ArrayLength.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "cooldown/CooldownMgr.h"
|
||||
|
||||
#include "../CooldownProvider.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "cooldown/CooldownProvider.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
|
|
|
@ -3,16 +3,25 @@
|
|||
*/
|
||||
|
||||
#include "BindingContext.h"
|
||||
#include "App.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
namespace _priv {
|
||||
static BindingContext _bindingContext = BindingContext::All;
|
||||
}
|
||||
|
||||
BindingContext bindingContext() {
|
||||
return core::App::getInstance()->bindingContext();
|
||||
return _priv::_bindingContext;
|
||||
}
|
||||
|
||||
BindingContext setBindingContext(int ctx) {
|
||||
return core::App::getInstance()->setBindingContext((core::BindingContext)ctx);
|
||||
const core::BindingContext newContext = (core::BindingContext)ctx;
|
||||
if (_priv::_bindingContext == newContext) {
|
||||
return newContext;
|
||||
}
|
||||
const core::BindingContext old = _priv::_bindingContext;
|
||||
_priv::_bindingContext = newContext;
|
||||
return old;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,11 +22,15 @@ enum BindingContext : uint8_t {
|
|||
};
|
||||
|
||||
/**
|
||||
* @brief Returns the current binding context
|
||||
* @brief Get the current binding context
|
||||
* @sa setBindingContext() for more details.
|
||||
*/
|
||||
extern BindingContext bindingContext();
|
||||
/**
|
||||
* @brief Updates the current binding context and returns the old one
|
||||
* @brief Allows to change the binding context. This can be used to e.g. ignore some commands while hovering
|
||||
* the ui and they should only be active if the scene has the focus.
|
||||
* @return the old context
|
||||
* @sa bindingContext()
|
||||
*/
|
||||
extern BindingContext setBindingContext(int ctx);
|
||||
|
||||
|
|
|
@ -40,13 +40,10 @@ set(SRCS
|
|||
Algorithm.h
|
||||
ArrayLength.h
|
||||
Assert.cpp Assert.h
|
||||
App.cpp App.h
|
||||
AppCommand.cpp AppCommand.h
|
||||
BindingContext.cpp BindingContext.h
|
||||
ByteStream.cpp ByteStream.h
|
||||
Color.cpp Color.h
|
||||
Common.cpp Common.h
|
||||
CommandlineApp.h CommandlineApp.cpp
|
||||
Enum.h
|
||||
EventBus.cpp EventBus.h
|
||||
FourCC.h
|
||||
|
@ -96,23 +93,18 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tracy/TracyClient.cpp)
|
|||
endif()
|
||||
|
||||
set(TEST_SRCS
|
||||
tests/AbstractTest.cpp
|
||||
tests/TestHelper.h
|
||||
tests/AlgorithmTest.cpp
|
||||
tests/AppTest.cpp
|
||||
tests/ArrayTest.cpp
|
||||
tests/BufferTest.cpp
|
||||
tests/ByteStreamTest.cpp
|
||||
tests/ColorTest.cpp
|
||||
tests/CommandTest.cpp
|
||||
tests/CommandCompleterTest.cpp
|
||||
tests/CommandHandlerTest.cpp
|
||||
tests/ConcurrentQueueTest.cpp
|
||||
tests/CoreTest.cpp
|
||||
tests/DynamicArrayTest.cpp
|
||||
tests/EventBusTest.cpp
|
||||
tests/FilesystemTest.cpp
|
||||
tests/FileStreamTest.cpp
|
||||
tests/FileTest.cpp
|
||||
tests/ListTest.cpp
|
||||
tests/LogTest.cpp
|
||||
tests/MapTest.cpp
|
||||
|
@ -131,24 +123,17 @@ set(TEST_SRCS
|
|||
tests/VectorTest.cpp
|
||||
tests/ZipTest.cpp
|
||||
)
|
||||
set(TEST_FILES
|
||||
tests/iotest.txt
|
||||
tests/tokenizer.string
|
||||
)
|
||||
|
||||
gtest_suite_files(tests ${TEST_FILES})
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_files(tests-${LIB} ${TEST_FILES})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
||||
set(BENCHMARK_SRCS
|
||||
benchmark/AbstractBenchmark.cpp
|
||||
benchmarks/CollectionBenchmark.cpp
|
||||
)
|
||||
engine_add_executable(TARGET benchmarks-${LIB} SRCS ${BENCHMARK_SRCS} NOINSTALL)
|
||||
engine_target_link_libraries(TARGET benchmarks-${LIB} DEPENDENCIES benchmark ${LIB})
|
||||
engine_target_link_libraries(TARGET benchmarks-${LIB} DEPENDENCIES benchmark-app)
|
||||
|
|
|
@ -2,15 +2,14 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "Log.h"
|
||||
#include "Var.h"
|
||||
#include "StringUtil.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/StringUtil.h"
|
||||
#include "engine-config.h"
|
||||
#include "App.h"
|
||||
#include "Common.h"
|
||||
#include "Enum.h"
|
||||
#include "ArrayLength.h"
|
||||
#include "Assert.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/Enum.h"
|
||||
#include "core/ArrayLength.h"
|
||||
#include "core/Assert.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unordered_map>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "Common.h"
|
||||
#include "Hash.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/Hash.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "core/benchmark/AbstractBenchmark.h"
|
||||
#include "app/benchmark/AbstractBenchmark.h"
|
||||
#include "core/collection/Map.h"
|
||||
#include "core/Assert.h"
|
||||
#include <unordered_map>
|
||||
|
|
|
@ -3,13 +3,11 @@
|
|||
*/
|
||||
|
||||
#include "CommandCompleter.h"
|
||||
#include "core/App.h"
|
||||
#include "core/StringUtil.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
int complete(core::String dir, const core::String& match, core::DynamicArray<core::String>& matches, const char* pattern) {
|
||||
int complete(const io::FilesystemPtr& filesystem, core::String dir, const core::String& match, core::DynamicArray<core::String>& matches, const char* pattern) {
|
||||
const core::String additionalDir = core::string::extractPath(match.c_str());
|
||||
dir += additionalDir;
|
||||
core::String currentMatch;
|
||||
|
@ -24,8 +22,7 @@ int complete(core::String dir, const core::String& match, core::DynamicArray<cor
|
|||
const core::String filter = match + pattern;
|
||||
const core::String& filterName = core::string::extractFilenameWithExtension(filter.c_str());
|
||||
const core::String& filterPath = core::string::extractPath(filter.c_str());
|
||||
const io::FilesystemPtr& fs = io::filesystem();
|
||||
fs->list(dir, entries, currentMatch + "*");
|
||||
filesystem->list(dir, entries, currentMatch + "*");
|
||||
int i = 0;
|
||||
for (const io::Filesystem::DirEntry& entry : entries) {
|
||||
if (entry.type == io::Filesystem::DirEntry::Type::dir) {
|
||||
|
@ -36,7 +33,7 @@ int complete(core::String dir, const core::String& match, core::DynamicArray<cor
|
|||
}
|
||||
}
|
||||
entries.clear();
|
||||
fs->list(dir, entries, core::String(filterName));
|
||||
filesystem->list(dir, entries, core::String(filterName));
|
||||
for (const io::Filesystem::DirEntry& entry : entries) {
|
||||
if (entry.type == io::Filesystem::DirEntry::Type::file) {
|
||||
matches.push_back(filterPath.empty() ? entry.name : filterPath + entry.name);
|
||||
|
|
|
@ -7,20 +7,21 @@
|
|||
#include "core/String.h"
|
||||
#include "core/collection/DynamicArray.h"
|
||||
#include "core/Var.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
extern int complete(core::String dir, const core::String& match, core::DynamicArray<core::String>& matches, const char* pattern);
|
||||
extern int complete(const io::FilesystemPtr& filesystem, core::String dir, const core::String& match, core::DynamicArray<core::String>& matches, const char* pattern);
|
||||
|
||||
inline auto fileCompleter(const core::String& lastDirectory, const char* pattern = "*") {
|
||||
inline auto fileCompleter(const io::FilesystemPtr& filesystem, const core::String& lastDirectory, const char* pattern = "*") {
|
||||
return [=] (const core::String& str, core::DynamicArray<core::String>& matches) -> int {
|
||||
return complete(lastDirectory, str, matches, pattern);
|
||||
return complete(filesystem, lastDirectory, str, matches, pattern);
|
||||
};
|
||||
}
|
||||
|
||||
inline auto fileCompleter(const core::VarPtr& lastDirectory, const char* pattern = "*") {
|
||||
inline auto fileCompleter(const io::FilesystemPtr& filesystem, const core::VarPtr& lastDirectory, const char* pattern = "*") {
|
||||
return [=] (const core::String& str, core::DynamicArray<core::String>& matches) -> int {
|
||||
return complete(lastDirectory->strVal(), str, matches, pattern);
|
||||
return complete(filesystem, lastDirectory->strVal(), str, matches, pattern);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,13 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/Color.h"
|
||||
#include <SDL_endian.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
class ColorTest: public AbstractTest {
|
||||
};
|
||||
|
||||
TEST_F(ColorTest, testRGBA) {
|
||||
TEST(ColorTest, testRGBA) {
|
||||
core::RGBA color;
|
||||
color.rgba = SDL_SwapLE32(0xff6699fe);
|
||||
EXPECT_EQ(0xfe, color.r);
|
||||
|
@ -34,7 +31,7 @@ TEST_F(ColorTest, testRGBA) {
|
|||
EXPECT_EQ(0xff, convertedBack.a);
|
||||
}
|
||||
|
||||
TEST_F(ColorTest, testHex) {
|
||||
TEST(ColorTest, testHex) {
|
||||
EXPECT_EQ(glm::vec4(1.0f), core::Color::fromHex("#ffffff"));
|
||||
EXPECT_EQ(glm::vec4(1.0f), core::Color::fromHex("0xffffff"));
|
||||
EXPECT_EQ(glm::vec4(1.0f), core::Color::fromHex("0xffffffff"));
|
||||
|
@ -43,7 +40,7 @@ TEST_F(ColorTest, testHex) {
|
|||
EXPECT_EQ(glm::vec4(1.0f, 0.0f, 0.0f, 1.0f), core::Color::fromHex("#ff0000ff"));
|
||||
}
|
||||
|
||||
TEST_F(ColorTest, testClosestMatchExact) {
|
||||
TEST(ColorTest, testClosestMatchExact) {
|
||||
const glm::vec4 color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
const std::vector<glm::vec4>& colors {
|
||||
glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
|
||||
|
@ -58,7 +55,7 @@ TEST_F(ColorTest, testClosestMatchExact) {
|
|||
EXPECT_EQ(3, index);
|
||||
}
|
||||
|
||||
TEST_F(ColorTest, testClosestMatch) {
|
||||
TEST(ColorTest, testClosestMatch) {
|
||||
const glm::vec4 color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
const std::vector<glm::vec4>& colors {
|
||||
glm::vec4(1.0f, 1.0f, 1.0f, 1.0f),
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/command/CommandHandler.h"
|
||||
#include "core/Var.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class CommandHandlerTest: public AbstractTest {
|
||||
class CommandHandlerTest: public testing::Test {
|
||||
public:
|
||||
void TearDown() override {
|
||||
core::Var::shutdown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(CommandHandlerTest, testReplacePlaceholdersSmallBuffer) {
|
||||
|
|
|
@ -2,12 +2,16 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/command/Command.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class CommandTest: public AbstractTest {
|
||||
class CommandTest: public testing::Test {
|
||||
public:
|
||||
void TearDown() override {
|
||||
Command::shutdown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(CommandTest, testExecuteUnknown) {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/EventBus.h"
|
||||
|
||||
namespace core {
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
class HandlerTest: public CountHandlerTest<TestEvent> {
|
||||
};
|
||||
|
||||
class EventBusTest : public core::AbstractTest {
|
||||
class EventBusTest : public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(EventBusTest, testSubscribeAndPublish_1) {
|
||||
|
|
|
@ -2,15 +2,12 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/Log.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class LogTest : public core::AbstractTest {
|
||||
};
|
||||
|
||||
TEST_F(LogTest, testLogId) {
|
||||
TEST(LogTest, testLogId) {
|
||||
const auto logid1 = Log::logid("LogTest1");
|
||||
const auto logid2 = Log::logid("LogTest2");
|
||||
ASSERT_NE(logid1, logid2);
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/MD5.h"
|
||||
#include <SDL_stdinc.h>
|
||||
|
||||
namespace core {
|
||||
|
||||
class MD5Test: public AbstractTest {
|
||||
};
|
||||
|
||||
TEST_F(MD5Test, test1) {
|
||||
TEST(MD5Test, test1) {
|
||||
const uint8_t buf[] = {'1'};
|
||||
ASSERT_EQ("c4ca4238a0b923820dcc509a6f75849b", md5sum(buf, SDL_arraysize(buf)));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/metric/Metric.h"
|
||||
#include "core/metric/IMetricSender.h"
|
||||
#include "core/Var.h"
|
||||
|
@ -26,19 +26,15 @@ public:
|
|||
|
||||
#define PREFIX "test"
|
||||
|
||||
class MetricTest: public core::AbstractTest {
|
||||
private:
|
||||
using Super = core::AbstractTest;
|
||||
class MetricTest: public testing::Test {
|
||||
protected:
|
||||
std::shared_ptr<BufferSender> sender;
|
||||
void SetUp() override {
|
||||
Super::SetUp();
|
||||
sender = std::make_shared<BufferSender>();
|
||||
ASSERT_TRUE(sender->init());
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
Super::TearDown();
|
||||
sender->shutdown();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/PoolAllocator.h"
|
||||
#include "core/ArrayLength.h"
|
||||
#include "AbstractTest.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class PoolAllocatorTest: public AbstractTest {
|
||||
class PoolAllocatorTest: public testing::Test {
|
||||
protected:
|
||||
static int calledCtor;
|
||||
static int calledDtor;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/concurrent/ReadWriteLock.h"
|
||||
#include <future>
|
||||
|
||||
namespace core {
|
||||
|
||||
class ReadWriteLockTest: public AbstractTest {
|
||||
class ReadWriteLockTest: public testing::Test {
|
||||
protected:
|
||||
core::ReadWriteLock _rwLock {"test"};
|
||||
int _value = 0;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/Common.h"
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "core/SharedPtr.h"
|
||||
#include "core/Algorithm.h"
|
||||
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/String.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class StringTest: public AbstractTest {
|
||||
class StringTest: public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(StringTest, testLongStringToForceAllocation) {
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/StringUtil.h"
|
||||
#include "core/Common.h"
|
||||
#include "core/StandardLib.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class StringUtilTest: public AbstractTest {
|
||||
class StringUtilTest: public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(StringUtilTest, testGetBeforeToken) {
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock.h>
|
||||
#include "core/CommandlineApp.h"
|
||||
#include "core/String.h"
|
||||
#include "core/collection/DynamicArray.h"
|
||||
#include <glm/glm.hpp>
|
||||
#define GLM_ENABLE_EXPERIMENTAL
|
||||
#include <glm/gtx/string_cast.hpp>
|
||||
|
@ -86,55 +86,6 @@ inline ::std::ostream& operator<<(::std::ostream& os, const glm::tvec1<T, P>& ve
|
|||
return os << "vec1[" << glm::to_string(vec) << "]";
|
||||
}
|
||||
|
||||
class AbstractTest: public testing::Test {
|
||||
private:
|
||||
class TestApp: public core::CommandlineApp {
|
||||
friend class AbstractTest;
|
||||
private:
|
||||
using Super = core::CommandlineApp;
|
||||
protected:
|
||||
AbstractTest* _test = nullptr;
|
||||
public:
|
||||
TestApp(const metric::MetricPtr& metric, const io::FilesystemPtr& filesystem, const core::EventBusPtr& eventBus, const core::TimeProviderPtr& timeProvider, AbstractTest* test);
|
||||
virtual ~TestApp();
|
||||
|
||||
core::AppState onInit() override;
|
||||
core::AppState onCleanup() override;
|
||||
};
|
||||
|
||||
protected:
|
||||
TestApp *_testApp = nullptr;
|
||||
|
||||
core::String toString(const core::String& filename) const;
|
||||
|
||||
template<class T>
|
||||
core::String toString(const T& v) const {
|
||||
core::String str;
|
||||
str.reserve(4096);
|
||||
for (auto i = v.begin(); i != v.end();) {
|
||||
str += "'";
|
||||
str += *i;
|
||||
str += "'";
|
||||
if (++i != v.end()) {
|
||||
str += ", ";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
virtual void onCleanupApp() {
|
||||
}
|
||||
|
||||
virtual bool onInitApp() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void SetUp() override;
|
||||
|
||||
virtual void TearDown() override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
inline std::ostream& operator<<(std::ostream& stream, const glm::ivec2& v) {
|
||||
|
@ -156,3 +107,18 @@ inline std::ostream& operator<<(std::ostream& stream, const glm::vec3& v) {
|
|||
stream << "(x: " << v.x << ", y: " << v.y << ", z: " << v.z << ")";
|
||||
return stream;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
core::String toString(const core::DynamicArray<T>& v) {
|
||||
core::String str;
|
||||
str.reserve(4096);
|
||||
for (auto i = v.begin(); i != v.end();) {
|
||||
str += "'";
|
||||
str += *i;
|
||||
str += "'";
|
||||
if (++i != v.end()) {
|
||||
str += ", ";
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
|
@ -2,19 +2,18 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/concurrent/ThreadPool.h"
|
||||
#include "core/concurrent/Atomic.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class ThreadPoolTest: public AbstractTest {
|
||||
class ThreadPoolTest: public testing::Test {
|
||||
public:
|
||||
core::AtomicInt _count;
|
||||
bool _executed = false;
|
||||
|
||||
void SetUp() override {
|
||||
AbstractTest::SetUp();
|
||||
_count = 0;
|
||||
_executed = false;
|
||||
}
|
||||
|
|
|
@ -2,19 +2,21 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/StringUtil.h"
|
||||
#include "core/tests/TestHelper.h"
|
||||
#include "core/Tokenizer.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class TokenizerTest: public AbstractTest {
|
||||
class TokenizerTest: public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(TokenizerTest, testTokenizerNoSkipComment) {
|
||||
const char *str = "http://foo.bar";
|
||||
core::Tokenizer t(false, str, SDL_strlen(str), ";");
|
||||
ASSERT_EQ(1u, t.size()) << toString(t.tokens());
|
||||
ASSERT_EQ(1u, t.size()) << string::toString(t.tokens());
|
||||
EXPECT_STREQ(str, t.tokens()[0].c_str()) << toString(t.tokens());
|
||||
}
|
||||
|
||||
|
@ -41,14 +43,9 @@ TEST_F(TokenizerTest, testTokenizerOnlyFirstMatch) {
|
|||
}
|
||||
|
||||
TEST_F(TokenizerTest, testTokenizerInvalidFile) {
|
||||
const io::FilePtr& file = io::filesystem()->open("tokenizer.string");
|
||||
ASSERT_TRUE(file->exists()) << "file doesn't exist";
|
||||
uint8_t *buf;
|
||||
const int n = file->read((void**)&buf);
|
||||
ASSERT_TRUE(buf != nullptr);
|
||||
core::Tokenizer t((const char *)buf, n, "\n");
|
||||
const char *buf = "\x22\x50\xe2\xf6\xe2\x20\xac\x55\x22";
|
||||
core::Tokenizer t(buf, 9, "\n");
|
||||
EXPECT_EQ(0u, t.size()) << toString(t.tokens());
|
||||
delete[] buf;
|
||||
}
|
||||
|
||||
TEST_F(TokenizerTest, testTokenizerSecondMatchButEmptyString) {
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/UUID.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class UUIDTest: public AbstractTest {
|
||||
class UUIDTest: public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(UUIDTest, test) {
|
||||
|
|
|
@ -2,13 +2,17 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/Var.h"
|
||||
#include "core/StringUtil.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class VarTest: public AbstractTest {
|
||||
class VarTest: public testing::Test {
|
||||
public:
|
||||
void TearDown() override {
|
||||
core::Var::shutdown();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(VarTest, testChange) {
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include <gtest/gtest.h>
|
||||
#include "core/Zip.h"
|
||||
|
||||
namespace core {
|
||||
|
||||
class ZipTest: public AbstractTest {
|
||||
class ZipTest: public testing::Test {
|
||||
};
|
||||
|
||||
TEST_F(ZipTest, testCompress) {
|
||||
|
|
|
@ -20,10 +20,10 @@ set(TEST_FILES
|
|||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_files(tests ${TEST_FILES})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_files(tests-${LIB} ${TEST_FILES})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
#include "EventProvider.h"
|
||||
#include "commonlua/LUA.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/ArrayLength.h"
|
||||
#include "core/Common.h"
|
||||
#include "persistence/DBHandler.h"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "ClientEntity.h"
|
||||
#include "animation/Vertex.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
#include "animation/AnimationSettings.h"
|
||||
#include "core/StringUtil.h"
|
||||
|
|
|
@ -28,9 +28,9 @@ set(TEST_SRCS
|
|||
)
|
||||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "core/ArrayLength.h"
|
||||
#include "core/Log.h"
|
||||
#include "Network.cpp.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include <string.h>
|
||||
#include <SDL_stdinc.h>
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "Request.h"
|
||||
#include "Url.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/ArrayLength.h"
|
||||
#include <string.h>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "core/collection/Map.h"
|
||||
|
||||
namespace http {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
|
||||
#include "core/concurrent/Atomic.h"
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "http/HttpClient.h"
|
||||
#include "http/HttpServer.h"
|
||||
#include "core/concurrent/ThreadPool.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "http/HttpHeader.h"
|
||||
|
||||
namespace http {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "http/HttpServer.h"
|
||||
|
||||
namespace http {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "http/Url.h"
|
||||
|
||||
namespace http {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "Image.h"
|
||||
#include "core/Log.h"
|
||||
#include "core/App.h"
|
||||
#include "app/App.h"
|
||||
#include "core/concurrent/ThreadPool.h"
|
||||
#include "core/Assert.h"
|
||||
#include "core/io/Filesystem.h"
|
||||
|
|
|
@ -25,9 +25,9 @@ set(TEST_SRCS
|
|||
)
|
||||
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB})
|
||||
gtest_suite_deps(tests ${LIB} test-app)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB})
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "math/AABB.h"
|
||||
|
||||
namespace math {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "math/Frustum.h"
|
||||
#include "core/GLM.h"
|
||||
#include "core/StringUtil.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "math/Octree.h"
|
||||
#include "math/AABB.h"
|
||||
#include "math/Frustum.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "math/Plane.h"
|
||||
#include "core/GLM.h"
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ set(TEST_SRCS
|
|||
tests/PoissonDiskDistributionTest.cpp
|
||||
)
|
||||
gtest_suite_sources(tests ${TEST_SRCS})
|
||||
gtest_suite_deps(tests ${LIB} image)
|
||||
gtest_suite_deps(tests ${LIB} test-app image)
|
||||
|
||||
gtest_suite_begin(tests-${LIB} TEMPLATE ${ROOT_DIR}/src/modules/core/tests/main.cpp.in)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS} ../core/tests/AbstractTest.cpp)
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} image)
|
||||
gtest_suite_sources(tests-${LIB} ${TEST_SRCS})
|
||||
gtest_suite_deps(tests-${LIB} ${LIB} test-app image)
|
||||
gtest_suite_end(tests-${LIB})
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "noise/Noise.h"
|
||||
#include "noise/Simplex.h"
|
||||
#include "image/Image.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "compute/Compute.h"
|
||||
#include "noise/Noise.h"
|
||||
#include "image/Image.h"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
#include "core/tests/AbstractTest.h"
|
||||
#include "app/tests/AbstractTest.h"
|
||||
#include "noise/PoissonDiskDistribution.h"
|
||||
|
||||
namespace noise {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue