From 34297a311ec5bd1e469f5a38d1c4965c4cc59240 Mon Sep 17 00:00:00 2001 From: Neil Date: Tue, 18 Oct 2016 13:07:51 +1100 Subject: Visual Studio project for running unit tests makes it easier to debug them. Debugging visualizer for SplitVector helps understand state of objects. --- test/unit/Sci.natvis | 20 ++++++ test/unit/UnitTester.cxx | 34 +++++++++ test/unit/UnitTester.vcxproj | 164 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+) create mode 100644 test/unit/Sci.natvis create mode 100644 test/unit/UnitTester.cxx create mode 100644 test/unit/UnitTester.vcxproj diff --git a/test/unit/Sci.natvis b/test/unit/Sci.natvis new file mode 100644 index 000000000..562dd7ae3 --- /dev/null +++ b/test/unit/Sci.natvis @@ -0,0 +1,20 @@ + + + + {{size = {lengthBody}}} + + lengthBody + (size) + part1Length + gapLength + + part1Length + body + + + lengthBody-part1Length + body+part1Length+gapLength + + + + diff --git a/test/unit/UnitTester.cxx b/test/unit/UnitTester.cxx new file mode 100644 index 000000000..9a3eb5195 --- /dev/null +++ b/test/unit/UnitTester.cxx @@ -0,0 +1,34 @@ +// UnitTester.cpp : Defines the entry point for the console application. +// + +#include +#include + +#include "Platform.h" + +#define CATCH_CONFIG_RUNNER +#include "catch.hpp" + +// Needed for PLATFORM_ASSERT in code being tested + +void Platform::Assert(const char *c, const char *file, int line) { + fprintf(stderr, "Assertion [%s] failed at %s %d\n", c, file, line); + abort(); +} + +void Platform::DebugPrintf(const char *format, ...) { + char buffer[2000]; + va_list pArguments; + va_start(pArguments, format); + vsprintf(buffer, format, pArguments); + va_end(pArguments); + fprintf(stderr, "%s", buffer); +} + +int main(int argc, char* const argv[]) { + const int result = Catch::Session().run(argc, argv); + + _CrtDumpMemoryLeaks(); + + return result; +} diff --git a/test/unit/UnitTester.vcxproj b/test/unit/UnitTester.vcxproj new file mode 100644 index 000000000..0554b68ba --- /dev/null +++ b/test/unit/UnitTester.vcxproj @@ -0,0 +1,164 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {35688A27-D91B-453A-8A05-65A7F28DEFBF} + Win32Proj + UnitTester + 8.1 + + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS=1;_SCL_SECURE_NO_WARNINGS=1;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include\;..\..\src\;..\..\lexlib\ + + + Console + true + + + + + + + Level3 + Disabled + _CRT_SECURE_NO_WARNINGS=1;_SCL_SECURE_NO_WARNINGS=1;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include\;..\..\src\;..\..\lexlib\ + + + Console + true + + + + + Level3 + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS=1;_SCL_SECURE_NO_WARNINGS=1;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include\;..\..\src\;..\..\lexlib\ + + + Console + true + true + true + + + + + Level3 + + + MaxSpeed + true + true + _CRT_SECURE_NO_WARNINGS=1;_SCL_SECURE_NO_WARNINGS=1;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include\;..\..\src\;..\..\lexlib\ + + + Console + true + true + true + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3