Fix running debug projects that use unit testing

This commit is contained in:
Birunthan Mohanathas 2013-06-13 20:17:24 +03:00
parent 384298a43e
commit ced3dd20ca
7 changed files with 44 additions and 12 deletions

View File

@ -37,6 +37,7 @@
<ClInclude Include="Platform.h" />
<ClInclude Include="RawString.h" />
<ClInclude Include="StringUtil.h" />
<ClInclude Include="Test.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">

View File

@ -18,5 +18,6 @@
<ClInclude Include="StringUtil.h" />
<ClInclude Include="ControlTemplate.h" />
<ClInclude Include="MathParser.h" />
<ClInclude Include="Test.h" />
</ItemGroup>
</Project>

View File

@ -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)

View File

@ -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 <Shlobj.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace PathUtil {
TEST_CLASS(Common_PathUtil_Test)

View File

@ -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)

38
Common/Test.h Normal file
View File

@ -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

View File

@ -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: