Skip to content

Commit

Permalink
Move test utility out of base package
Browse files Browse the repository at this point in the history
  • Loading branch information
albin-johansson committed Aug 2, 2024
1 parent dc87599 commit 3cdfd1a
Show file tree
Hide file tree
Showing 28 changed files with 59 additions and 55 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ endif ()

add_subdirectory("source/proto")
add_subdirectory("source/base")

if (TACTILE_BUILD_TESTS)
add_subdirectory("source/test_util")
endif ()

add_subdirectory("source/core")
add_subdirectory("source/runtime")
add_subdirectory("source/json_util")
Expand Down
1 change: 0 additions & 1 deletion source/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,4 @@ target_sources(tactile-base

if (TACTILE_BUILD_TESTS)
add_subdirectory("test")
add_subdirectory("test_util")
endif ()
27 changes: 0 additions & 27 deletions source/base/test_util/CMakeLists.txt

This file was deleted.

2 changes: 1 addition & 1 deletion source/core/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ tactile_prepare_target(tactile-core-test)
target_link_libraries(tactile-core-test
PRIVATE
tactile::core
tactile::base_test_util
tactile::test_util
tactile::null_renderer
GTest::gtest
)
2 changes: 1 addition & 1 deletion source/core/test/src/layer/layer_common_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <gtest/gtest.h>

#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/layer/group_layer.hpp"
#include "tactile/core/layer/object_layer.hpp"
#include "tactile/core/layer/tile_layer.hpp"
#include "tactile/core/test/ir_comparison.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
2 changes: 1 addition & 1 deletion source/core/test/src/layer/object_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

#include <gtest/gtest.h>

#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/meta/meta.hpp"
#include "tactile/core/test/ir_comparison.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
4 changes: 2 additions & 2 deletions source/core/test/src/map/map_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include <gtest/gtest.h>

#include "tactile/base/test_util/ir.hpp"
#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/layer/group_layer.hpp"
#include "tactile/core/layer/layer.hpp"
Expand All @@ -16,6 +14,8 @@
#include "tactile/core/tile/tileset_spec.hpp"
#include "tactile/core/ui/viewport.hpp"
#include "tactile/null_renderer/null_renderer.hpp"
#include "tactile/test_util/ir.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
2 changes: 1 addition & 1 deletion source/core/test/src/meta/meta_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/test/ir_comparison.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
2 changes: 1 addition & 1 deletion source/core/test/src/tile/tile_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <gtest/gtest.h>

#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/layer/object.hpp"
#include "tactile/core/meta/meta.hpp"
#include "tactile/core/test/ir_comparison.hpp"
#include "tactile/core/tile/animation.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
2 changes: 1 addition & 1 deletion source/core/test/src/tile/tileset_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <gtest/gtest.h>

#include "tactile/base/numeric/saturate_cast.hpp"
#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/core/entity/registry.hpp"
#include "tactile/core/io/texture.hpp"
#include "tactile/core/meta/meta.hpp"
Expand All @@ -15,6 +14,7 @@
#include "tactile/core/tile/tileset_spec.hpp"
#include "tactile/core/ui/viewport.hpp"
#include "tactile/null_renderer/null_renderer.hpp"
#include "tactile/test_util/ir_presets.hpp"

namespace tactile::test {

Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions source/test_util/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
project(tactile-test-util CXX)

add_library(tactile-test-util STATIC)
add_library(tactile::test_util ALIAS tactile-test-util)

target_sources(tactile-test-util
PRIVATE
"src/document_view_mocks.cpp"
"src/ir.cpp"
"src/ir_eq.cpp"
"src/ir_presets.cpp"

PUBLIC FILE_SET "HEADERS" BASE_DIRS "inc" FILES
"inc/tactile/test_util/document_view_mocks.hpp"
"inc/tactile/test_util/ir.hpp"
"inc/tactile/test_util/ir_eq.hpp"
"inc/tactile/test_util/ir_presets.hpp"
)

tactile_prepare_target(tactile-test-util)

target_link_libraries(tactile-test-util
PUBLIC
tactile::base
GTest::gtest
GTest::gmock
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0)

#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/test_util/document_view_mocks.hpp"

#include <utility> // move

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0)

#include "tactile/base/test_util/ir.hpp"
#include "tactile/test_util/ir.hpp"

#include <format> // format
#include <utility> // move
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0)

#include "tactile/base/test_util/ir_eq.hpp"
#include "tactile/test_util/ir_eq.hpp"

#include <algorithm> // find_if
#include <format> // format
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (C) 2024 Albin Johansson (GNU General Public License v3.0)

#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/test_util/ir_presets.hpp"

#include <utility> // move

#include "tactile/base/test_util/ir.hpp"
#include "tactile/test_util/ir.hpp"

namespace tactile::test {

Expand Down
2 changes: 1 addition & 1 deletion source/tiled_tmj_format/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tactile_prepare_target(tactile-tiled-tmj-format-test)
target_link_libraries(tactile-tiled-tmj-format-test
PRIVATE
tactile::tiled_tmj_format
tactile::base_test_util
tactile::test_util
tactile::null_renderer
$<$<BOOL:TACTILE_BUILD_ZLIB_COMPRESSION>:tactile::zlib_compression>
$<$<BOOL:TACTILE_BUILD_ZSTD_COMPRESSION>:tactile::zstd_compression>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

#include "tactile/base/io/tile_io.hpp"
#include "tactile/base/platform/bits.hpp"
#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/base/test_util/ir.hpp"
#include "tactile/runtime/runtime.hpp"
#include "tactile/test_util/document_view_mocks.hpp"
#include "tactile/test_util/ir.hpp"

#ifdef TACTILE_HAS_ZLIB_COMPRESSION
#include "tactile/zlib_compression/zlib_compression_plugin.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/base/test_util/ir.hpp"
#include "tactile/test_util/document_view_mocks.hpp"
#include "tactile/test_util/ir.hpp"

namespace tactile::test {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <gtest/gtest.h>

#include "tactile/base/meta/attribute.hpp"
#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/test_util/document_view_mocks.hpp"

namespace tactile::test {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <gtest/gtest.h>

#include "tactile/base/meta/attribute.hpp"
#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/test_util/document_view_mocks.hpp"

namespace tactile::test {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

#include "tactile/base/container/maybe.hpp"
#include "tactile/base/container/string.hpp"
#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/base/test_util/ir.hpp"
#include "tactile/base/test_util/ir_eq.hpp"
#include "tactile/base/test_util/ir_presets.hpp"
#include "tactile/test_util/document_view_mocks.hpp"
#include "tactile/test_util/ir.hpp"
#include "tactile/test_util/ir_eq.hpp"
#include "tactile/test_util/ir_presets.hpp"
#include "tactile/runtime/runtime.hpp"
#include "tactile/tiled_tmj_format/tmj_format_plugin.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/base/test_util/ir.hpp"
#include "tactile/test_util/document_view_mocks.hpp"
#include "tactile/test_util/ir.hpp"

namespace tactile::test {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "tactile/base/test_util/document_view_mocks.hpp"
#include "tactile/test_util/document_view_mocks.hpp"

namespace tactile::test {

Expand Down

0 comments on commit 3cdfd1a

Please sign in to comment.