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
This commit is contained in:
hrydgard 2009-02-01 14:21:08 +00:00
parent 44058d8d63
commit 411fdca4fd
5 changed files with 5 additions and 161 deletions

View File

@ -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"
@ -750,22 +750,6 @@
RelativePath=".\Src\StringUtil.h"
>
</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"
>

View File

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

View File

@ -19,7 +19,6 @@
#include <stdio.h>
#include "StringUtil.h"
#include "TestFramework.h"
// faster than sscanf
bool AsciiToHex(const char* _szValue, u32& result)

View File

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

View File

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