diff options
| author | hrydgard <hrydgard@gmail.com> | 2009-02-01 14:21:08 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2009-02-01 14:21:08 +0000 |
| commit | 411fdca4fd610b4989c18d766b36f1352cb60dc5 (patch) | |
| tree | 4579986a8a710bbd48f4efaf72d2ebb86a40ebc2 /Source/Core/Common | |
| parent | 44058d8d638829f1779019e68776b95fd4ed9034 (diff) | |
kill useless unit testing framework that doesn't work :p
might make or add a better one later.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2053 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
| -rw-r--r-- | Source/Core/Common/Common.vcproj | 18 | ||||
| -rw-r--r-- | Source/Core/Common/Src/SConscript | 9 | ||||
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 1 | ||||
| -rw-r--r-- | Source/Core/Common/Src/TestFramework.cpp | 38 | ||||
| -rw-r--r-- | Source/Core/Common/Src/TestFramework.h | 100 |
5 files changed, 5 insertions, 161 deletions
diff --git a/Source/Core/Common/Common.vcproj b/Source/Core/Common/Common.vcproj index 94f460401e..b0993ec1a6 100644 --- a/Source/Core/Common/Common.vcproj +++ b/Source/Core/Common/Common.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
- Version="9.00"
+ Version="9,00"
Name="Common"
ProjectGUID="{C573CAF7-EE6A-458E-8049-16C0BF34C2E9}"
RootNamespace="Common"
@@ -751,22 +751,6 @@ >
</File>
<File
- RelativePath=".\Src\TestFramework.cpp"
- >
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- GeneratePreprocessedFile="0"
- />
- </FileConfiguration>
- </File>
- <File
- RelativePath=".\Src\TestFramework.h"
- >
- </File>
- <File
RelativePath=".\Src\Thread.cpp"
>
</File>
diff --git a/Source/Core/Common/Src/SConscript b/Source/Core/Common/Src/SConscript index 04d08f8d97..bec078e21b 100644 --- a/Source/Core/Common/Src/SConscript +++ b/Source/Core/Common/Src/SConscript @@ -18,12 +18,11 @@ files = [ "MemArena.cpp", "MemoryUtil.cpp", "Plugin.cpp", - "PluginDSP.cpp", - "PluginWiimote.cpp", - "PluginVideo.cpp", - "PluginPAD.cpp", + "PluginDSP.cpp", + "PluginWiimote.cpp", + "PluginVideo.cpp", + "PluginPAD.cpp", "StringUtil.cpp", - "TestFramework.cpp", "Thunk.cpp", "Timer.cpp", "Thread.cpp", diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp index 303122c949..28cb67d08b 100644 --- a/Source/Core/Common/Src/StringUtil.cpp +++ b/Source/Core/Common/Src/StringUtil.cpp @@ -19,7 +19,6 @@ #include <stdio.h> #include "StringUtil.h" -#include "TestFramework.h" // faster than sscanf bool AsciiToHex(const char* _szValue, u32& result) diff --git a/Source/Core/Common/Src/TestFramework.cpp b/Source/Core/Common/Src/TestFramework.cpp deleted file mode 100644 index d805db5996..0000000000 --- a/Source/Core/Common/Src/TestFramework.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2003-2008 Dolphin Project. - -// 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, version 2.0. - -// 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 2.0 for more details. - -// A copy of the GPL 2.0 should have been included with the program. -// If not, see http://www.gnu.org/licenses/ - -// Official SVN repository and contact information can be found at -// http://code.google.com/p/dolphin-emu/ - -#include "TestFramework.h" - -namespace __test -{ -int numTests; -int numTestsFailed; -} - - -int GetNumTests() -{ - return(__test::numTests); -} - - -int GetNumTestsFailed() -{ - return(__test::numTestsFailed); -} - - diff --git a/Source/Core/Common/Src/TestFramework.h b/Source/Core/Common/Src/TestFramework.h deleted file mode 100644 index 66d635e905..0000000000 --- a/Source/Core/Common/Src/TestFramework.h +++ /dev/null @@ -1,100 +0,0 @@ -// Stupidly simple automated testing framework -// by ector - -// licence: Public Domain - -// If TESTING_ENABLE is true, all tests across the project will run before main(). -// If it's false, all tests will be destroyed by the linker, hopefully. - -// Unfortunately, MSVC:s library linker seems to kill off unreferenced objects, even if the -// initialization has side effects. This makes this framework not work properly :( -// TODO(ector): Find solution. - -// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P - -#define TESTING_ENABLE - -#ifndef _TEST_FRAMEWORK_H -#define _TEST_FRAMEWORK_H - -#include "Common.h" -#include <stdio.h> - -#ifdef TESTING_ENABLE - -namespace __test -{ -extern int numTests; -extern int numTestsFailed; -} - -struct TestRunnah -{ - const char* filename; - const char* function; - TestRunnah(const char* _filename, const char* _function) - : filename(_filename), function(_function) {} - - - bool AssertTrue(bool value, int line) - { - if (!value) - { - char string[256]; - sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); - PanicAlert("Test Results: %s", string); - TestFailed(); - return(false); - } - - return(true); - } - - - template<class T> - bool AssertEqual(T a, T b, int line) - { - if (!(a == b)) - { - // TODO(ector) : better output - char string[256]; - sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed"); - PanicAlert("Test Results: %s", string); - TestFailed(); - return(false); - } - } - - - void TestFailed() - { - __test::numTestsFailed++; - } -}; - - -#define TEST(a) \ - void TEST_ ## a(TestRunnah * __tr); \ - struct DUMMY_ ## a \ - : public TestRunnah { \ - DUMMY_ ## a() \ - : TestRunnah(__FILE__, # a) {\ - TEST_ ## a(this); __test::numTests++;} }; \ - DUMMY_ ## a ddummy_ ## a; \ - void TEST_ ## a(TestRunnah * __tr) - -#else // TESTING_ENABLE - -#define TEST(a) \ - void TEST_ ## a(TestRunnah * __tr) \ - -#endif - -#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;} -#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;} - -int GetNumTests(); -int GetNumTestsFailed(); - - -#endif |
