From 71b57a323867e9ea532f1a7c8c4239c5cfb0dbc5 Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Thu, 13 Jan 2022 01:24:09 +0200 Subject: [PATCH] added regression test to detect ODR violations --- tests/meson.build | 8 ++++ tests/odr_test_1.cpp | 8 ++++ tests/odr_test_2.cpp | 3 ++ tests/vs/odr_test.vcxproj | 82 +++++++++++++++++++++++++++++++++++++++ toml++.sln | 7 ++++ 5 files changed, 108 insertions(+) create mode 100644 tests/odr_test_1.cpp create mode 100644 tests/odr_test_2.cpp create mode 100644 tests/vs/odr_test.vcxproj diff --git a/tests/meson.build b/tests/meson.build index b34f43a..07af5b7 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -188,3 +188,11 @@ foreach executable : test_executables ) endforeach endforeach + + +# add the ODR-test build project +executable( + 'odr_test', + [ 'odr_test_1.cpp', 'odr_test_2.cpp' ], + include_directories: include_dirs +) diff --git a/tests/odr_test_1.cpp b/tests/odr_test_1.cpp new file mode 100644 index 0000000..2664330 --- /dev/null +++ b/tests/odr_test_1.cpp @@ -0,0 +1,8 @@ +#define TOML_ENABLE_UNRELEASED_FEATURES 1 +#define TOML_HEADER_ONLY 1 +#include "../toml.hpp" + +int main() +{ + return 0; +} diff --git a/tests/odr_test_2.cpp b/tests/odr_test_2.cpp new file mode 100644 index 0000000..4920690 --- /dev/null +++ b/tests/odr_test_2.cpp @@ -0,0 +1,3 @@ +#define TOML_ENABLE_UNRELEASED_FEATURES 1 +#define TOML_HEADER_ONLY 1 +#include "../toml.hpp" diff --git a/tests/vs/odr_test.vcxproj b/tests/vs/odr_test.vcxproj new file mode 100644 index 0000000..31da645 --- /dev/null +++ b/tests/vs/odr_test.vcxproj @@ -0,0 +1,82 @@ + + + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {723FC4CA-0E24-4956-8FDC-E537EA3847AA} + 10.0 + x64 + + + + Application + true + v143 + MultiByte + + + Application + false + v143 + true + MultiByte + + + + + + + + + ..\tests;%(AdditionalIncludeDirectories) + Sync + NotUsing + stdcpp17 + true + EnableAllWarnings + %(DisableSpecificWarnings);4127 + %(DisableSpecificWarnings);4324 + %(DisableSpecificWarnings);4464 + %(DisableSpecificWarnings);4505 + %(DisableSpecificWarnings);4514 + %(DisableSpecificWarnings);4577 + %(DisableSpecificWarnings);4582 + %(DisableSpecificWarnings);4623 + %(DisableSpecificWarnings);4625 + %(DisableSpecificWarnings);4626 + %(DisableSpecificWarnings);4710 + %(DisableSpecificWarnings);4711 + %(DisableSpecificWarnings);4738 + %(DisableSpecificWarnings);4820 + %(DisableSpecificWarnings);4866 + %(DisableSpecificWarnings);4868 + %(DisableSpecificWarnings);4946 + %(DisableSpecificWarnings);5026 + %(DisableSpecificWarnings);5027 + %(DisableSpecificWarnings);5039 + %(DisableSpecificWarnings);5045 + + + + $(ProjectDir)..\ + + + + + + + + + + + + diff --git a/toml++.sln b/toml++.sln index 43756a9..c2b58a7 100644 --- a/toml++.sln +++ b/toml++.sln @@ -89,6 +89,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tt_decoder", "toml-test\tt_ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tt_encoder", "toml-test\tt_encoder.vcxproj", "{8F673261-5DFE-4B67-937A-61FC3F0082A2}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "odr_test", "tests\vs\odr_test.vcxproj", "{723FC4CA-0E24-4956-8FDC-E537EA3847AA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -253,6 +255,10 @@ Global {8F673261-5DFE-4B67-937A-61FC3F0082A2}.Debug|x64.Build.0 = Debug|x64 {8F673261-5DFE-4B67-937A-61FC3F0082A2}.Release|x64.ActiveCfg = Release|x64 {8F673261-5DFE-4B67-937A-61FC3F0082A2}.Release|x64.Build.0 = Release|x64 + {723FC4CA-0E24-4956-8FDC-E537EA3847AA}.Debug|x64.ActiveCfg = Debug|x64 + {723FC4CA-0E24-4956-8FDC-E537EA3847AA}.Debug|x64.Build.0 = Debug|x64 + {723FC4CA-0E24-4956-8FDC-E537EA3847AA}.Release|x64.ActiveCfg = Release|x64 + {723FC4CA-0E24-4956-8FDC-E537EA3847AA}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -297,6 +303,7 @@ Global {407FCAA8-FC2C-424D-B44B-C6A1AFAD757A} = {412816A5-9D22-4A30-BCDF-ABFB54BB3735} {8D19DE49-9687-4305-B59E-21F398415F5A} = {5DE43BF4-4EDD-4A7A-A422-764415BB3224} {8F673261-5DFE-4B67-937A-61FC3F0082A2} = {5DE43BF4-4EDD-4A7A-A422-764415BB3224} + {723FC4CA-0E24-4956-8FDC-E537EA3847AA} = {4E25CF88-D7D8-4A9C-A52E-0D78281E82EC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {0926DDCC-88CD-4839-A82D-D9B99E02A0B1}