Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CSE3150_Project/Test.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
61 lines (50 sloc)
1010 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Test.h | |
* | |
* Author: Jamey Calabrese | |
* | |
* Description: This is the unit test class header. | |
* | |
*/ | |
#ifndef TEST_H | |
#define TEST_H | |
#include <iostream> | |
#include <vector> | |
class UnitTest | |
{ | |
public: | |
UnitTest(); | |
virtual ~UnitTest(); | |
void TestIntro(); | |
void TestConclusion(); | |
bool Passed(); | |
virtual void PerformTest() = 0; | |
protected: | |
void Fail(); | |
void AssertTrue(bool expression); | |
void AssertFalse(bool expression); | |
template<class T> | |
void AssertEquals(T a, T b) { if (a != b) { Fail(); } } | |
std::string testName; | |
private: | |
bool passed; | |
}; | |
class ComponentTest | |
{ | |
public: | |
ComponentTest(); | |
virtual ~ComponentTest(); | |
void PrintIntro(); | |
void PrintConclusion(); | |
bool TestComponent(); | |
unsigned long long GetTestCount(); | |
unsigned long long GetTestsFailed(); | |
unsigned long long GetTestsPassed(); | |
protected: | |
std::vector<UnitTest*> tests; | |
unsigned long long run; | |
unsigned long long failed; | |
unsigned long long passed; | |
std::string testName; | |
}; | |
#endif /* TEST_H */ |