From 411fdca4fd610b4989c18d766b36f1352cb60dc5 Mon Sep 17 00:00:00 2001 From: hrydgard Date: Sun, 1 Feb 2009 14:21:08 +0000 Subject: [PATCH] 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 --- Source/Core/Common/Common.vcproj | 18 +--- Source/Core/Common/Src/SConscript | 9 +- Source/Core/Common/Src/StringUtil.cpp | 1 - Source/Core/Common/Src/TestFramework.cpp | 38 --------- Source/Core/Common/Src/TestFramework.h | 100 ----------------------- 5 files changed, 5 insertions(+), 161 deletions(-) delete mode 100644 Source/Core/Common/Src/TestFramework.cpp delete mode 100644 Source/Core/Common/Src/TestFramework.h 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 @@ - - - - - - - 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 #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 - -#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 - 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