Added Criterion unit test framework
This commit is contained in:
1 parent
a82550d414
commit
c22569cc48
7 files changed
+39
-269
No files matched your search
+3
-2
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.12)
|
|||||||
project("RedScarfEngine"
|
project("RedScarfEngine"
|
||||||
VERSION 0.0.1
|
VERSION 0.0.1
|
||||||
DESCRIPTION "Vulkan based 3D engine"
|
DESCRIPTION "Vulkan based 3D engine"
|
||||||
LANGUAGES CXX)
|
LANGUAGES C CXX)
|
||||||
|
|
||||||
|
|
||||||
# make sure c++ 20 is set
|
# make sure c++ 20 is set
|
||||||
@@ -32,4 +32,5 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
|
|||||||
|
|
||||||
add_subdirectory(red_scarf_engine)
|
add_subdirectory(red_scarf_engine)
|
||||||
add_subdirectory(utilities)
|
add_subdirectory(utilities)
|
||||||
add_subdirectory(graphics)
|
add_subdirectory(graphics)
|
||||||
|
add_subdirectory(tests)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
set(CRITERION_DIR "${PROJECT_SOURCE_DIR}/third_party/Criterion/")
|
||||||
|
|
||||||
|
find_library(
|
||||||
|
criterion
|
||||||
|
NAMES criterion
|
||||||
|
HINTS ${CRITERION_DIR}/build/src
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
set(criterion_INCLUDE_DIR "${CRITERION_DIR}/include/")
|
||||||
-267
@@ -1,267 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "1.3.250.0",
|
|
||||||
"release_date": "2023-05-30",
|
|
||||||
"release": true,
|
|
||||||
"publisher": "LunarG, Inc.",
|
|
||||||
"copyright": "Copyright (c) 2016-2023 LunarG, Inc.",
|
|
||||||
"comments" : "Building using the branch will build the most recent SDK on that branch. If you want to build a previous SDK on that branch, use the tag",
|
|
||||||
"repos": {
|
|
||||||
"Vulkan-Headers": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Headers.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "Release" ]
|
|
||||||
},
|
|
||||||
"Vulkan-Loader": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Loader.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"defines": [
|
|
||||||
"BUILD_DLL_VERSIONINFO={version_string}"
|
|
||||||
],
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Vulkan-ValidationLayers": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-ValidationLayers.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"defines": [
|
|
||||||
"BUILD_LAYER_SUPPORT_FILES=ON",
|
|
||||||
"ANNOTATED_SPEC_LINK=\"\\\"https://vulkan.lunarg.com/doc/view/_MAGIC_VERSION_ID_.0/windows/_MAGIC_ANNOTATED_SPEC_TYPE_/vkspec.html\\\"\""
|
|
||||||
],
|
|
||||||
"configs": [ "Release" ],
|
|
||||||
"dependencies": {
|
|
||||||
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR",
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
|
|
||||||
"SPIRV-Tools": "SPIRV_TOOLS_INSTALL_DIR",
|
|
||||||
"robin-hood-hashing": "ROBIN_HOOD_HASHING_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"windows_dependencies": {
|
|
||||||
"mimalloc": "MIMALLOC_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"vk_layer_settings_files": [ "layers/vk_layer_settings.txt" ]
|
|
||||||
},
|
|
||||||
"Vulkan-ExtensionLayer": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-ExtensionLayer.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "Release" ],
|
|
||||||
"defines": ["BUILD_TESTS=OFF"],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
|
|
||||||
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR",
|
|
||||||
"SPIRV-Tools": "SPIRV_TOOLS_INSTALL_DIR",
|
|
||||||
"Glslang": "GLSLANG_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"vk_layer_settings_files": [ "layers/vk_layer_settings.txt" ]
|
|
||||||
},
|
|
||||||
"Khronos-Tools": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Tools.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"defines": [
|
|
||||||
"VULKANINFO_BUILD_DLL_VERSIONINFO={version_string}"
|
|
||||||
],
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
|
|
||||||
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Glslang": {
|
|
||||||
"url": "https://github.com/KhronosGroup/glslang.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"script": [ "python update_glslang_sources.py" ],
|
|
||||||
"configs": [ "RelWithDebInfo", "Debug" ]
|
|
||||||
},
|
|
||||||
"LunarG-Tools": {
|
|
||||||
"url": "https://github.com/LunarG/VulkanTools.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"script": [ "update_external_sources.bat --all" ],
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
|
|
||||||
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
|
|
||||||
"Vulkan-ValidationLayers": "VULKAN_VALIDATIONLAYERS_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"vk_layer_settings_files": [ "layersvt/vk_layer_settings.txt" ]
|
|
||||||
},
|
|
||||||
"SPIRV-Cross": {
|
|
||||||
"url": "https://github.com/KhronosGroup/SPIRV-Cross.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"defines": [ "SPIRV_CROSS_SHARED=ON" ],
|
|
||||||
"configs": [ "Release", "Debug" ]
|
|
||||||
},
|
|
||||||
"SPIRV-Tools": {
|
|
||||||
"url": "https://github.com/KhronosGroup/SPIRV-Tools.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "Release", "Debug" ],
|
|
||||||
"dependencies": {
|
|
||||||
"SPIRV-Headers": "SPIRV_HEADERS_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"defines": [
|
|
||||||
"SPIRV-Headers_SOURCE_DIR={root_path_forward}/SPIRV-Headers/repo"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"shaderc": {
|
|
||||||
"url": "https://github.com/google/shaderc.git",
|
|
||||||
"commit": "8226ab8d003b3249d8da9c83159482d180f38959",
|
|
||||||
"script": [ "python update_shaderc_sources.py" ],
|
|
||||||
"defines": [
|
|
||||||
"CMAKE_DEBUG_POSTFIX=d",
|
|
||||||
"SHADERC_SKIP_TESTS=ON",
|
|
||||||
"SHADERC_ENABLE_SHARED_CRT=ON",
|
|
||||||
"SHADERC_SKIP_COPYRIGHT_CHECK=ON"
|
|
||||||
],
|
|
||||||
"subdir": "src",
|
|
||||||
"configs": [ "Release", "Debug" ],
|
|
||||||
"build_target": null
|
|
||||||
},
|
|
||||||
"DXC": {
|
|
||||||
"url": "https://github.com/microsoft/DirectXShaderCompiler.git",
|
|
||||||
"commit": "021f8f3e1267db0f0e3362276cdda95785de0529",
|
|
||||||
"platforms": ["Linux", "Darwin"],
|
|
||||||
"appveyor_account": "dnovillo",
|
|
||||||
"appveyor_project": "directxshadercompiler",
|
|
||||||
"windows_appveyor_image": "Image: Visual Studio 2022"
|
|
||||||
},
|
|
||||||
"gfxreconstruct": {
|
|
||||||
"url": "https://github.com/LunarG/gfxreconstruct.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"windows_compiler": "Visual Studio 16",
|
|
||||||
"defines": [ "D3D12_SUPPORT=OFF" ],
|
|
||||||
"vk_layer_settings_files": [ "layer/vk_layer_settings.txt" ]
|
|
||||||
},
|
|
||||||
"SPIRV-Headers": {
|
|
||||||
"url": "https://github.com/KhronosGroup/SPIRV-Headers.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "RelWithDebInfo" ]
|
|
||||||
},
|
|
||||||
"SPIRV-Reflect": {
|
|
||||||
"url": "https://github.com/KhronosGroup/SPIRV-Reflect.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"build_target": "spirv-reflect"
|
|
||||||
},
|
|
||||||
"MoltenVK": {
|
|
||||||
"url": "https://github.com/KhronosGroup/MoltenVK.git",
|
|
||||||
"tag": "v1.2.4",
|
|
||||||
"platforms": ["Darwin"]
|
|
||||||
},
|
|
||||||
"HardwareCaps": {
|
|
||||||
"url": "https://github.com/SaschaWillems/VulkanCapsViewer.git",
|
|
||||||
"tag": "3.30",
|
|
||||||
"configs": [ "Release" ],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Volk": {
|
|
||||||
"url": "https://github.com/zeux/volk.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": [ "RelWithDebInfo" ],
|
|
||||||
"defines": [
|
|
||||||
"VOLK_INSTALL=ON",
|
|
||||||
"VOLK_PULL_IN_VULKAN=ON"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"VMA": {
|
|
||||||
"url": "https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git",
|
|
||||||
"commit": "0e89587db3ebee4d463f191bd296374c5fafc8ea",
|
|
||||||
"check_latest_release": true
|
|
||||||
},
|
|
||||||
"GLM": {
|
|
||||||
"url": "https://github.com/g-truc/glm.git",
|
|
||||||
"check_latest_release": true,
|
|
||||||
"tag": "0.9.9.8"
|
|
||||||
},
|
|
||||||
"SDL": {
|
|
||||||
"url": "https://github.com/libsdl-org/SDL.git",
|
|
||||||
"tag": "release-2.26.5",
|
|
||||||
"check_latest_release": true,
|
|
||||||
"configs": ["RelWithDebInfo"]
|
|
||||||
},
|
|
||||||
"Vulkan-Docs": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Docs.git",
|
|
||||||
"tag": "v1.3.250"
|
|
||||||
},
|
|
||||||
"robin-hood-hashing": {
|
|
||||||
"url": "https://github.com/martinus/robin-hood-hashing.git",
|
|
||||||
"tag": "3.11.5",
|
|
||||||
"defines": [
|
|
||||||
"RH_STANDALONE_PROJECT=OFF"
|
|
||||||
],
|
|
||||||
"configs": ["Release"]
|
|
||||||
},
|
|
||||||
"Vulkan-Utility-Libraries": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Utility-Libraries.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"configs": ["RelWithDebInfo"],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"Vulkan-Profiles": {
|
|
||||||
"url": "https://github.com/KhronosGroup/Vulkan-Profiles.git",
|
|
||||||
"branch": "sdk-1.3.250",
|
|
||||||
"tag": "sdk-1.3.250.0",
|
|
||||||
"configs": ["Release"],
|
|
||||||
"dependencies": {
|
|
||||||
"Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR",
|
|
||||||
"Vulkan-Headers": "VULKAN_HEADERS_INSTALL_DIR",
|
|
||||||
"Vulkan-ValidationLayers": "VULKAN_VALIDATIONLAYERS_INSTALL_DIR",
|
|
||||||
"jsoncpp": "JSONCPP_INSTALL_DIR",
|
|
||||||
"valijson": "VALIJSON_INSTALL_DIR",
|
|
||||||
"Vulkan-Utility-Libraries": "VULKAN_UTILITY_LIBRARIES_INSTALL_DIR"
|
|
||||||
},
|
|
||||||
"defines": [
|
|
||||||
"PROFILES_BUILD_TESTS=OFF"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"jsoncpp": {
|
|
||||||
"url": "https://github.com/open-source-parsers/jsoncpp.git",
|
|
||||||
"tag": "1.9.5",
|
|
||||||
"configs": ["RelWithDebInfo"],
|
|
||||||
"defines": [
|
|
||||||
"CMAKE_POSITION_INDEPENDENT_CODE=ON",
|
|
||||||
"JSONCPP_WITH_TESTS=OFF",
|
|
||||||
"JSONCPP_WITH_POST_BUILD_UNITTEST=OFF",
|
|
||||||
"JSONCPP_WITH_WARNING_AS_ERROR=OFF",
|
|
||||||
"JSONCPP_WITH_PKGCONFIG_SUPPORT=OFF"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"valijson": {
|
|
||||||
"url": "https://github.com/tristanpenman/valijson.git",
|
|
||||||
"tag": "v1.0",
|
|
||||||
"configs": ["RelWithDebInfo"]
|
|
||||||
},
|
|
||||||
"mimalloc": {
|
|
||||||
"url": "https://github.com/microsoft/mimalloc.git",
|
|
||||||
"tag": "v2.0.7",
|
|
||||||
"configs": ["RelWithDebInfo"],
|
|
||||||
"platforms": ["Windows"],
|
|
||||||
"defines": [
|
|
||||||
"MI_BUILD_STATIC=ON",
|
|
||||||
"MI_BUILD_OBJECT=OFF",
|
|
||||||
"MI_BUILD_SHARED=OFF",
|
|
||||||
"MI_BUILD_TESTS=OFF"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -15,3 +15,8 @@ custom_commands = tar -xf Vulkan-SDK && mv 1.3.250.1 vulkan && rm Vulkan-SDK
|
|||||||
[vma]
|
[vma]
|
||||||
git_url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
|
git_url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
|
||||||
tag = v3.0.1
|
tag = v3.0.1
|
||||||
|
|
||||||
|
[Criterion]
|
||||||
|
git_url = https://github.com/Snaipe/Criterion.git
|
||||||
|
tag = v2.4.2
|
||||||
|
custom_commands = cd Criterion && meson build && cd build && ninja
|
||||||
@@ -70,6 +70,7 @@ def main():
|
|||||||
if uncommented.startswith("["):
|
if uncommented.startswith("["):
|
||||||
dep_name = re.search('\[(.*)\]', uncommented).group(1)
|
dep_name = re.search('\[(.*)\]', uncommented).group(1)
|
||||||
dep = Dependency(dep_name, f)
|
dep = Dependency(dep_name, f)
|
||||||
|
print("Downloading dependency " + dep_name + "...")
|
||||||
dep.download()
|
dep.download()
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
find_package(Criterion)
|
||||||
|
|
||||||
|
add_executable(tests
|
||||||
|
src/rse_math_tests.c)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
target_include_directories(tests PRIVATE
|
||||||
|
${criterion_INCLUDE_DIR})
|
||||||
|
|
||||||
|
target_link_libraries(tests PRIVATE
|
||||||
|
${criterion})
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "criterion/criterion.h"
|
||||||
|
|
||||||
|
Test(sampe, test)
|
||||||
|
{
|
||||||
|
cr_expect(strlen("Tests") == 4, "Expected \"Test\" to have lenght of 4");
|
||||||
|
}
|
||||||
Reference in new issue
Block a user