diff --git a/CppUnitLite/Failure.cpp b/CppUnitLite/Failure.cpp deleted file mode 100644 index 591485b04..000000000 --- a/CppUnitLite/Failure.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* ---------------------------------------------------------------------------- - - * GTSAM Copyright 2010, Georgia Tech Research Corporation, - * Atlanta, Georgia 30332-0415 - * All Rights Reserved - * Authors: Frank Dellaert, et al. (see THANKS for the full author list) - - * See LICENSE for the license information - - * -------------------------------------------------------------------------- */ - - - -#include "Failure.h" - -Failure::Failure (const std::string& theTestName, - const std::string& theFileName, - long theLineNumber, - const std::string& theCondition) -: message (theCondition), - testName (theTestName), - fileName (theFileName), - lineNumber (theLineNumber) -{ -} - -Failure::Failure (const std::string& theTestName, - const std::string& theFileName, - const std::string& theCondition) -: message (theCondition), - testName (theTestName), - fileName (theFileName), - lineNumber (-1) -{ -} - - -Failure::Failure (const std::string& theTestName, - const std::string& theFileName, - long theLineNumber, - const std::string& expected, - const std::string& actual) -: message("expected " + expected + " but was: " + actual), - testName (theTestName), - fileName (theFileName), - lineNumber (theLineNumber) -{ -} - - diff --git a/CppUnitLite/Failure.h b/CppUnitLite/Failure.h index 210ccd63d..93c99df12 100644 --- a/CppUnitLite/Failure.h +++ b/CppUnitLite/Failure.h @@ -21,8 +21,7 @@ /////////////////////////////////////////////////////////////////////////////// -#ifndef FAILURE_H -#define FAILURE_H +#pragma once #include @@ -30,27 +29,42 @@ class Failure { public: - Failure (const std::string& theTestName, - const std::string& theFileName, - long theLineNumber, - const std::string& theCondition); + Failure (const std::string& theTestName, + const std::string& theFileName, + long theLineNumber, + const std::string& theCondition) + : message (theCondition), + testName (theTestName), + fileName (theFileName), + lineNumber (theLineNumber) + { + } - Failure (const std::string& theTestName, - const std::string& theFileName, - long theLineNumber, - const std::string& expected, - const std::string& actual); + Failure (const std::string& theTestName, + const std::string& theFileName, + const std::string& theCondition) + : message (theCondition), + testName (theTestName), + fileName (theFileName), + lineNumber (-1) + { + } - Failure (const std::string& theTestName, - const std::string& theFileName, - const std::string& theCondition); + Failure (const std::string& theTestName, + const std::string& theFileName, + long theLineNumber, + const std::string& expected, + const std::string& actual) + : message("expected " + expected + " but was: " + actual), + testName (theTestName), + fileName (theFileName), + lineNumber (theLineNumber) + { + } std::string message; std::string testName; std::string fileName; long lineNumber; }; - - -#endif diff --git a/CppUnitLite/Test.cpp b/CppUnitLite/Test.cpp index 07230436e..e6a2ad51f 100644 --- a/CppUnitLite/Test.cpp +++ b/CppUnitLite/Test.cpp @@ -18,13 +18,13 @@ #include Test::Test (const std::string& testName) - : name_ (testName) + : name_ (testName), next_(0), lineNumber_(-1), safeCheck_(true) { TestRegistry::addTest (this); } -Test::Test (const std::string& testName, const std::string& filename, long lineNumber, bool safeCheck = true) - : name_(testName), filename_(filename), lineNumber_(lineNumber), safeCheck_(safeCheck) +Test::Test (const std::string& testName, const std::string& filename, long lineNumber, bool safeCheck) + : name_(testName), next_(0), filename_(filename), lineNumber_(lineNumber), safeCheck_(safeCheck) { TestRegistry::addTest (this); } diff --git a/CppUnitLite/Test.h b/CppUnitLite/Test.h index d5d5d1d2f..820ed48cf 100644 --- a/CppUnitLite/Test.h +++ b/CppUnitLite/Test.h @@ -27,8 +27,6 @@ class TestResult; - - class Test { public: