diff --git a/Common/Common.vcxproj b/Common/Common.vcxproj index 97eeda9d..94d6cb41 100644 --- a/Common/Common.vcxproj +++ b/Common/Common.vcxproj @@ -37,6 +37,7 @@ + diff --git a/Common/Common.vcxproj.filters b/Common/Common.vcxproj.filters index 2f4f152e..85332656 100644 --- a/Common/Common.vcxproj.filters +++ b/Common/Common.vcxproj.filters @@ -18,5 +18,6 @@ + \ No newline at end of file diff --git a/Common/MathParser_Test.cpp b/Common/MathParser_Test.cpp index 7c547769..fb75bbb7 100644 --- a/Common/MathParser_Test.cpp +++ b/Common/MathParser_Test.cpp @@ -16,11 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "CppUnitTest.h" +#include "Test.h" #include "MathParser.h" -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - namespace MathParser { TEST_CLASS(Common_MathParser_Test) diff --git a/Common/PathUtil_Test.cpp b/Common/PathUtil_Test.cpp index 61d920ef..60dbc391 100644 --- a/Common/PathUtil_Test.cpp +++ b/Common/PathUtil_Test.cpp @@ -16,12 +16,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "CppUnitTest.h" +#include "Test.h" #include "PathUtil.h" #include -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - namespace PathUtil { TEST_CLASS(Common_PathUtil_Test) diff --git a/Common/StringUtil_Test.cpp b/Common/StringUtil_Test.cpp index 6797b2b4..673348a1 100644 --- a/Common/StringUtil_Test.cpp +++ b/Common/StringUtil_Test.cpp @@ -16,11 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "CppUnitTest.h" +#include "Test.h" #include "StringUtil.h" -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - namespace StringUtil { TEST_CLASS(Common_StringUtil_Test) diff --git a/Common/Test.h b/Common/Test.h new file mode 100644 index 00000000..c7d3a8d0 --- /dev/null +++ b/Common/Test.h @@ -0,0 +1,38 @@ +/* + Copyright (C) 2013 Rainmeter Team + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef RM_COMMON_TEST_H +#define RM_COMMON_TEST_H + +// This file is meant to be included only by unit testing .cpp files. + +#include "CppUnitTest.h" + +#ifndef _DEBUG +#error Unit testing is not available in Release builds. +#endif + +// DLL projects should delay-load the CppUnitTestFramework.dll to avoid "module not found" errors +// since CppUnitTestFramework.dll is available only when running tests. +#ifdef _MD +#pragma comment(linker, "/DELAYLOAD:Microsoft.VisualStudio.TestTools.CppUnitTestFramework.dll") +#endif + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +#endif diff --git a/Library/ConfigParser_Test.cpp b/Library/ConfigParser_Test.cpp index 4dc63df6..7ca46ac6 100644 --- a/Library/ConfigParser_Test.cpp +++ b/Library/ConfigParser_Test.cpp @@ -16,11 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "CppUnitTest.h" +#include "../Common/Test.h" #include "ConfigParser.h" -using namespace Microsoft::VisualStudio::CppUnitTestFramework; - TEST_CLASS(Library_ConfigParser_Test) { public: