mirror of
https://github.com/BlackMATov/ecs.hpp.git
synced 2025-12-13 02:26:27 +07:00
Merge branch 'dev' into main
This commit is contained in:
@@ -7,34 +7,17 @@ platform:
|
||||
- x64
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
for:
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x86
|
||||
configuration: Debug
|
||||
build_script:
|
||||
- scripts\build_debug_x86.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x64
|
||||
configuration: Debug
|
||||
build_script:
|
||||
- scripts\build_debug_x64.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
only:
|
||||
- platform: x86
|
||||
configuration: Release
|
||||
build_script:
|
||||
- scripts\build_release_x86.bat
|
||||
- .ci\build_windows_x86.bat
|
||||
|
||||
-
|
||||
matrix:
|
||||
@@ -42,4 +25,4 @@ for:
|
||||
- platform: x64
|
||||
configuration: Release
|
||||
build_script:
|
||||
- scripts\build_release_x64.bat
|
||||
- .ci\build_windows_x64.bat
|
||||
|
||||
19
.ci/build_coverage.sh
Executable file
19
.ci/build_coverage.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/coverage"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
|
||||
(cd "${BUILD_DIR}" && lcov -d . -z)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
|
||||
(cd "${BUILD_DIR}" && lcov -d . -c -o "coverage.info")
|
||||
(cd "${BUILD_DIR}" && lcov -r "coverage.info" "*/usr/*" "*/untests/*" -o "coverage.info")
|
||||
(cd "${BUILD_DIR}" && lcov -l "coverage.info")
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -f "${BUILD_DIR}/coverage.info" || echo "Codecov did not collect coverage reports"
|
||||
11
.ci/build_darwin.sh
Executable file
11
.ci/build_darwin.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/darwin_release"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
11
.ci/build_linux.sh
Executable file
11
.ci/build_linux.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE}" )" && pwd )"
|
||||
|
||||
ROOT_DIR="${DIR}/.."
|
||||
BUILD_DIR="${ROOT_DIR}/build/linux_release"
|
||||
|
||||
mkdir -p "${BUILD_DIR}"
|
||||
(cd "${BUILD_DIR}" && cmake "${ROOT_DIR}" -DCMAKE_BUILD_TYPE=Release)
|
||||
(cd "${BUILD_DIR}" && cmake --build .)
|
||||
(cd "${BUILD_DIR}" && ctest --verbose)
|
||||
19
.ci/build_windows_x64.bat
Normal file
19
.ci/build_windows_x64.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
set DIR=%~dp0
|
||||
|
||||
set ROOT_DIR=%DIR%..\
|
||||
set BUILD_DIR=%ROOT_DIR%build\windows_release_x64\
|
||||
|
||||
if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error
|
||||
|
||||
pushd %BUILD_DIR% || goto :error
|
||||
cmake %ROOT_DIR% -A x64 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
19
.ci/build_windows_x86.bat
Normal file
19
.ci/build_windows_x86.bat
Normal file
@@ -0,0 +1,19 @@
|
||||
@echo off
|
||||
set DIR=%~dp0
|
||||
|
||||
set ROOT_DIR=%DIR%..\
|
||||
set BUILD_DIR=%ROOT_DIR%build\windows_release_x86\
|
||||
|
||||
if not exist %BUILD_DIR% mkdir %BUILD_DIR% || goto :error
|
||||
|
||||
pushd %BUILD_DIR% || goto :error
|
||||
cmake %ROOT_DIR% -A Win32 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,4 +0,0 @@
|
||||
ignore:
|
||||
- "catch.hpp"
|
||||
- "catch_main.hpp"
|
||||
- "*_tests.cpp"
|
||||
156
.travis.yml
156
.travis.yml
@@ -1,143 +1,81 @@
|
||||
git:
|
||||
depth: false
|
||||
quiet: true
|
||||
|
||||
language: cpp
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
|
||||
#
|
||||
# windows (MSVC 2017)
|
||||
#
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: debug, MSVC 2017, x86
|
||||
script: ./scripts/build_debug_x86.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: release, MSVC 2017, x86
|
||||
script: ./scripts/build_release_x86.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: debug, MSVC 2017, x64
|
||||
script: ./scripts/build_debug_x64.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: release, MSVC 2017, x64
|
||||
script: ./scripts/build_release_x64.bat
|
||||
|
||||
#
|
||||
# linux (g++-7)
|
||||
# linux (g++)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
stage: linux
|
||||
name: debug, g++-7
|
||||
name: g++-7
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-7"] } }
|
||||
env: CC=gcc-7 CXX=g++-7
|
||||
script: ./scripts/build_debug.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
stage: linux
|
||||
name: release, g++-7
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-7"] } }
|
||||
env: CC=gcc-7 CXX=g++-7
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# linux (g++-8)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, g++-8
|
||||
name: g++-8
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-8"] } }
|
||||
env: CC=gcc-8 CXX=g++-8
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, g++-8
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["g++-8"] } }
|
||||
env: CC=gcc-8 CXX=g++-8
|
||||
script: ./scripts/build_release.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
#
|
||||
# linux (clang++-5.0)
|
||||
# linux (clang++)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
stage: linux
|
||||
name: debug, clang++-5.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["g++-7", "clang-5.0"] } }
|
||||
name: clang++-5.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["clang-5.0"] } }
|
||||
env: CC=clang-5.0 CXX=clang++-5.0
|
||||
script: ./scripts/build_debug.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
stage: linux
|
||||
name: release, clang++-5.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-5.0"], packages: ["g++-7", "clang-5.0"] } }
|
||||
env: CC=clang-5.0 CXX=clang++-5.0
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# linux (clang++-6.0)
|
||||
#
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: debug, clang++-6.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["g++-7", "clang-6.0"] } }
|
||||
name: clang++-6.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test"], packages: ["clang-6.0"] } }
|
||||
env: CC=clang-6.0 CXX=clang++-6.0
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: linux
|
||||
dist: xenial
|
||||
stage: linux
|
||||
name: release, clang++-6.0
|
||||
addons: { apt: { sources: ["ubuntu-toolchain-r-test", "llvm-toolchain-xenial-6.0"], packages: ["g++-7", "clang-6.0"] } }
|
||||
env: CC=clang-6.0 CXX=clang++-6.0
|
||||
script: ./scripts/build_release.sh
|
||||
script: .ci/build_linux.sh
|
||||
|
||||
#
|
||||
# macosx (xcode10)
|
||||
# darwin
|
||||
#
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
stage: macosx
|
||||
name: debug, xcode10
|
||||
script: ./scripts/build_debug.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
stage: macosx
|
||||
name: release, xcode10
|
||||
script: ./scripts/build_release.sh
|
||||
|
||||
#
|
||||
# macosx (xcode11)
|
||||
#
|
||||
stage: darwin
|
||||
name: xcode10
|
||||
script: .ci/build_darwin.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
stage: macosx
|
||||
name: debug, xcode11
|
||||
script: ./scripts/build_debug.sh
|
||||
stage: darwin
|
||||
name: xcode11
|
||||
script: .ci/build_darwin.sh
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode11
|
||||
stage: macosx
|
||||
name: release, xcode11
|
||||
script: ./scripts/build_release.sh
|
||||
#
|
||||
# windows
|
||||
#
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: x86
|
||||
script: .ci/build_windows_x86.bat
|
||||
|
||||
- os: windows
|
||||
stage: windows
|
||||
name: x64
|
||||
script: .ci/build_windows_x64.bat
|
||||
|
||||
#
|
||||
# coverage
|
||||
@@ -146,14 +84,6 @@ matrix:
|
||||
- os: osx
|
||||
osx_image: xcode10
|
||||
stage: coverage
|
||||
name: coverage, xcode10
|
||||
name: coverage
|
||||
addons: { homebrew: { packages: ["lcov"], update: true } }
|
||||
script: ./scripts/upload_coverage.sh
|
||||
|
||||
before_install:
|
||||
- if [ "$TRAVIS_OS_NAME" == 'linux' ]; then
|
||||
mkdir $HOME/cmake;
|
||||
export PATH="$HOME/cmake/bin:$PATH";
|
||||
travis_retry wget -q https://cmake.org/files/v3.11/cmake-3.11.4-Linux-x86_64.sh;
|
||||
sh cmake-3.11.4-Linux-x86_64.sh --prefix=$HOME/cmake --exclude-subdir --skip-license;
|
||||
fi
|
||||
script: .ci/build_coverage.sh
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/ecs.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
@echo off
|
||||
set SCRIPT_DIR=%~dp0%
|
||||
call %SCRIPT_DIR%\build_debug_x86.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_debug_x64.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_release_x86.bat || goto :error
|
||||
call %SCRIPT_DIR%\build_release_x64.bat || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
SCRIPT_DIR=`dirname "$BASH_SOURCE"`
|
||||
$SCRIPT_DIR/build_debug.sh
|
||||
$SCRIPT_DIR/build_release.sh
|
||||
@@ -1,9 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
rmdir /s /q %BUILD_DIR% || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
rm -rf $BUILD_DIR
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/Debug
|
||||
pushd $BUILD_DIR/Debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ../..
|
||||
cmake --build .
|
||||
ctest --verbose
|
||||
popd
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Debug\x64 || goto :error
|
||||
pushd %BUILD_DIR%\Debug\x64 || goto :error
|
||||
cmake ..\..\.. -A x64 || goto :error
|
||||
cmake --build . --config Debug || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Debug\x86 || goto :error
|
||||
pushd %BUILD_DIR%\Debug\x86 || goto :error
|
||||
cmake ..\..\.. -A Win32 || goto :error
|
||||
cmake --build . --config Debug || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/Release
|
||||
pushd $BUILD_DIR/Release
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ../..
|
||||
cmake --build .
|
||||
ctest --verbose
|
||||
popd
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Release\x64 || goto :error
|
||||
pushd %BUILD_DIR%\Release\x64 || goto :error
|
||||
cmake ..\..\.. -A x64 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,14 +0,0 @@
|
||||
@echo off
|
||||
set BUILD_DIR=%~dp0%\..\build
|
||||
mkdir %BUILD_DIR%\Release\x86 || goto :error
|
||||
pushd %BUILD_DIR%\Release\x86 || goto :error
|
||||
cmake ..\..\.. -A Win32 || goto :error
|
||||
cmake --build . --config Release || goto :error
|
||||
ctest --verbose || goto :error
|
||||
popd || goto :error
|
||||
|
||||
goto :EOF
|
||||
|
||||
:error
|
||||
echo Failed with error #%errorlevel%.
|
||||
exit /b %errorlevel%
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
BUILD_DIR=`dirname "$BASH_SOURCE"`/../build
|
||||
mkdir -p $BUILD_DIR/coverage
|
||||
cd $BUILD_DIR/coverage
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_WITH_COVERAGE=ON ../..
|
||||
cmake --build .
|
||||
|
||||
lcov -d . -z
|
||||
ctest --verbose
|
||||
|
||||
lcov -d . -c -o "coverage.info"
|
||||
lcov -r "coverage.info" "*/usr/*" "*/catch.hpp" "*/catch_main.cpp" "*_tests.cpp" "*_examples.cpp" -o "coverage.info"
|
||||
lcov -l "coverage.info"
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
|
||||
@@ -1,6 +1,3 @@
|
||||
# 3.11 version is required for `FetchContent`
|
||||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR)
|
||||
|
||||
project(ecs.hpp.untests)
|
||||
|
||||
#
|
||||
@@ -19,7 +16,7 @@ endif()
|
||||
# executable
|
||||
#
|
||||
|
||||
file(GLOB UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
file(GLOB_RECURSE UNTESTS_SOURCES "*.cpp" "*.hpp")
|
||||
add_executable(${PROJECT_NAME} ${UNTESTS_SOURCES})
|
||||
target_link_libraries(${PROJECT_NAME} ecs.hpp)
|
||||
|
||||
@@ -32,20 +29,3 @@ target_compile_options(${PROJECT_NAME}
|
||||
-Wall -Wextra -Wpedantic>)
|
||||
|
||||
add_test(${PROJECT_NAME} ${PROJECT_NAME})
|
||||
|
||||
#
|
||||
# catchorg/catch2
|
||||
#
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
catchorg_catch2
|
||||
GIT_REPOSITORY https://github.com/catchorg/catch2
|
||||
GIT_TAG v2.13.2)
|
||||
|
||||
FetchContent_GetProperties(catchorg_catch2)
|
||||
if(NOT catchorg_catch2_POPULATED)
|
||||
FetchContent_Populate(catchorg_catch2)
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PRIVATE ${catchorg_catch2_SOURCE_DIR}/single_include)
|
||||
endif()
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/ecs.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#include <catch2/catch.hpp>
|
||||
2
untests/doctest/doctest.cpp
Normal file
2
untests/doctest/doctest.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
||||
#include "doctest.h"
|
||||
6260
untests/doctest/doctest.h
Normal file
6260
untests/doctest/doctest.h
Normal file
File diff suppressed because it is too large
Load Diff
11
untests/doctest/doctest.hpp
Normal file
11
untests/doctest/doctest.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "doctest.h"
|
||||
|
||||
#define STATIC_REQUIRE(...)\
|
||||
static_assert(__VA_ARGS__, #__VA_ARGS__);\
|
||||
REQUIRE(__VA_ARGS__);
|
||||
|
||||
#define STATIC_REQUIRE_FALSE(...)\
|
||||
static_assert(!(__VA_ARGS__), "!(" #__VA_ARGS__ ")");\
|
||||
REQUIRE(!(__VA_ARGS__));
|
||||
@@ -1,18 +1,17 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/ecs.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <ecs.hpp/ecs.hpp>
|
||||
namespace ecs = ecs_hpp;
|
||||
#include "doctest/doctest.h"
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace ecs = ecs_hpp;
|
||||
|
||||
TEST_CASE("example") {
|
||||
|
||||
// events
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/ecs.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#define CATCH_CONFIG_FAST_COMPILE
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <ecs.hpp/ecs.hpp>
|
||||
#include "doctest/doctest.h"
|
||||
|
||||
namespace ecs = ecs_hpp;
|
||||
|
||||
namespace
|
||||
@@ -59,7 +58,7 @@ namespace
|
||||
}
|
||||
|
||||
TEST_CASE("detail") {
|
||||
SECTION("get_type_id") {
|
||||
SUBCASE("get_type_id") {
|
||||
using namespace ecs::detail;
|
||||
|
||||
const auto p_id = type_family<position_c>::id();
|
||||
@@ -75,7 +74,7 @@ TEST_CASE("detail") {
|
||||
REQUIRE(p_id == type_family<position_c>::id());
|
||||
REQUIRE(v_id == type_family<velocity_c>::id());
|
||||
}
|
||||
SECTION("tuple_tail") {
|
||||
SUBCASE("tuple_tail") {
|
||||
using namespace ecs::detail;
|
||||
{
|
||||
REQUIRE(tuple_tail(std::make_tuple(1, 2, 3)) == std::make_tuple(2, 3));
|
||||
@@ -91,7 +90,7 @@ TEST_CASE("detail") {
|
||||
REQUIRE(tuple_tail(t3) == std::make_tuple(2, 3));
|
||||
}
|
||||
}
|
||||
SECTION("tuple_contains") {
|
||||
SUBCASE("tuple_contains") {
|
||||
using namespace ecs::detail;
|
||||
{
|
||||
REQUIRE_FALSE(tuple_contains(std::make_tuple(), nullptr));
|
||||
@@ -105,7 +104,7 @@ TEST_CASE("detail") {
|
||||
REQUIRE_FALSE(tuple_contains(std::make_tuple(1,2,3), 4));
|
||||
}
|
||||
}
|
||||
SECTION("entity_id") {
|
||||
SUBCASE("entity_id") {
|
||||
using namespace ecs::detail;
|
||||
{
|
||||
REQUIRE(entity_id_index(entity_id_join(10u, 20u)) == 10u);
|
||||
@@ -116,7 +115,7 @@ TEST_CASE("detail") {
|
||||
REQUIRE(upgrade_entity_id(entity_id_join(2048u, 1023u)) == entity_id_join(2048u, 0u));
|
||||
}
|
||||
}
|
||||
SECTION("sparse_set") {
|
||||
SUBCASE("sparse_set") {
|
||||
using namespace ecs::detail;
|
||||
{
|
||||
sparse_set<unsigned, mult_indexer> s{mult_indexer{}};
|
||||
@@ -197,7 +196,7 @@ TEST_CASE("detail") {
|
||||
REQUIRE(s.get_dense_index(position_c(3,4)) == 0);
|
||||
}
|
||||
}
|
||||
SECTION("sparse_map") {
|
||||
SUBCASE("sparse_map") {
|
||||
using namespace ecs::detail;
|
||||
{
|
||||
struct obj_t {
|
||||
@@ -315,7 +314,7 @@ TEST_CASE("detail") {
|
||||
}
|
||||
|
||||
TEST_CASE("registry") {
|
||||
SECTION("entities") {
|
||||
SUBCASE("entities") {
|
||||
{
|
||||
ecs::registry w;
|
||||
ecs::entity e1{w};
|
||||
@@ -440,7 +439,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE_FALSE(w.entity_count());
|
||||
}
|
||||
}
|
||||
SECTION("components") {
|
||||
SUBCASE("components") {
|
||||
{
|
||||
ecs::registry w;
|
||||
ecs::entity e{w};
|
||||
@@ -610,7 +609,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(w.remove_all_components<movable_c>() == 0u);
|
||||
}
|
||||
}
|
||||
SECTION("prototypes") {
|
||||
SUBCASE("prototypes") {
|
||||
{
|
||||
ecs::prototype p;
|
||||
p.component<position_c>(1, 2);
|
||||
@@ -736,7 +735,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(c2 == velocity_c(0,0));
|
||||
}
|
||||
}
|
||||
SECTION("component_assigning") {
|
||||
SUBCASE("component_assigning") {
|
||||
{
|
||||
ecs::registry w;
|
||||
ecs::entity e1 = w.create_entity();
|
||||
@@ -830,7 +829,7 @@ TEST_CASE("registry") {
|
||||
e1.destroy();
|
||||
}
|
||||
}
|
||||
SECTION("component_ensuring") {
|
||||
SUBCASE("component_ensuring") {
|
||||
{
|
||||
ecs::registry w;
|
||||
ecs::entity e1 = w.create_entity();
|
||||
@@ -855,7 +854,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(c1.get() == velocity_c(20, 10));
|
||||
}
|
||||
}
|
||||
SECTION("component_accessing") {
|
||||
SUBCASE("component_accessing") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -982,7 +981,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e1.get_component<velocity_c>().y == 40);
|
||||
}
|
||||
}
|
||||
SECTION("cloning") {
|
||||
SUBCASE("cloning") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -1010,7 +1009,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e3.get_component<position_c>() == position_c(1, 2));
|
||||
}
|
||||
}
|
||||
SECTION("for_each_entity") {
|
||||
SUBCASE("for_each_entity") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -1034,7 +1033,7 @@ TEST_CASE("registry") {
|
||||
}
|
||||
}
|
||||
}
|
||||
SECTION("for_each_component") {
|
||||
SUBCASE("for_each_component") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -1109,7 +1108,7 @@ TEST_CASE("registry") {
|
||||
}
|
||||
}
|
||||
}
|
||||
SECTION("for_joined_components") {
|
||||
SUBCASE("for_joined_components") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -1191,7 +1190,7 @@ TEST_CASE("registry") {
|
||||
});
|
||||
}
|
||||
}
|
||||
SECTION("aspects") {
|
||||
SUBCASE("aspects") {
|
||||
{
|
||||
using empty_aspect = ecs::aspect<>;
|
||||
|
||||
@@ -1287,7 +1286,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e2.get_component<position_c>().y == 2);
|
||||
}
|
||||
}
|
||||
SECTION("options") {
|
||||
SUBCASE("options") {
|
||||
{
|
||||
ecs::registry w;
|
||||
|
||||
@@ -1468,7 +1467,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e1.get_component<position_c>() == position_c(1,2));
|
||||
}
|
||||
}
|
||||
SECTION("systems") {
|
||||
SUBCASE("systems") {
|
||||
struct update_evt {
|
||||
int dt{};
|
||||
};
|
||||
@@ -1531,7 +1530,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e.get_component<position_c>().x == 1 + (3 + 9 * 2) * 2);
|
||||
REQUIRE(e.get_component<position_c>().y == 2 + (4 + 9 * 2) * 2);
|
||||
}
|
||||
SECTION("recursive_systems") {
|
||||
SUBCASE("recursive_systems") {
|
||||
struct update_evt {
|
||||
int dt{};
|
||||
};
|
||||
@@ -1605,7 +1604,7 @@ TEST_CASE("registry") {
|
||||
|
||||
REQUIRE(w.component_count<velocity_c>() == 0);
|
||||
}
|
||||
SECTION("fillers") {
|
||||
SUBCASE("fillers") {
|
||||
struct component_n {
|
||||
int i = 0;
|
||||
component_n(int ni) : i(ni) {}
|
||||
@@ -1646,7 +1645,7 @@ TEST_CASE("registry") {
|
||||
REQUIRE(e2.get_component<component_n>().i == 5);
|
||||
}
|
||||
}
|
||||
SECTION("memory_usage") {
|
||||
SUBCASE("memory_usage") {
|
||||
{
|
||||
ecs::registry w;
|
||||
REQUIRE(w.memory_usage().entities == 0u);
|
||||
@@ -1729,7 +1728,7 @@ TEST_CASE("registry") {
|
||||
2 * sizeof(ecs::entity_id));
|
||||
}
|
||||
}
|
||||
SECTION("empty_component") {
|
||||
SUBCASE("empty_component") {
|
||||
ecs::registry w;
|
||||
auto e1 = w.create_entity();
|
||||
ecs::entity_filler(e1)
|
||||
|
||||
Reference in New Issue
Block a user