Removed cpp file for Failure, small cleanups

release/4.3a0
Alex Cunningham 2012-07-18 15:43:55 +00:00
parent 6266a2c56d
commit 8fa77de2a0
4 changed files with 34 additions and 72 deletions

View File

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

View File

@ -21,8 +21,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#ifndef FAILURE_H #pragma once
#define FAILURE_H
#include <string> #include <string>
@ -30,27 +29,42 @@ class Failure
{ {
public: public:
Failure (const std::string& theTestName, Failure (const std::string& theTestName,
const std::string& theFileName, const std::string& theFileName,
long theLineNumber, long theLineNumber,
const std::string& theCondition); const std::string& theCondition)
: message (theCondition),
testName (theTestName),
fileName (theFileName),
lineNumber (theLineNumber)
{
}
Failure (const std::string& theTestName, Failure (const std::string& theTestName,
const std::string& theFileName, const std::string& theFileName,
long theLineNumber, const std::string& theCondition)
const std::string& expected, : message (theCondition),
const std::string& actual); 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 message;
std::string testName; std::string testName;
std::string fileName; std::string fileName;
long lineNumber; long lineNumber;
}; };
#endif

View File

@ -18,13 +18,13 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
Test::Test (const std::string& testName) Test::Test (const std::string& testName)
: name_ (testName) : name_ (testName), next_(0), lineNumber_(-1), safeCheck_(true)
{ {
TestRegistry::addTest (this); TestRegistry::addTest (this);
} }
Test::Test (const std::string& testName, const std::string& filename, long lineNumber, bool safeCheck = true) Test::Test (const std::string& testName, const std::string& filename, long lineNumber, bool safeCheck)
: name_(testName), filename_(filename), lineNumber_(lineNumber), safeCheck_(safeCheck) : name_(testName), next_(0), filename_(filename), lineNumber_(lineNumber), safeCheck_(safeCheck)
{ {
TestRegistry::addTest (this); TestRegistry::addTest (this);
} }

View File

@ -27,8 +27,6 @@
class TestResult; class TestResult;
class Test class Test
{ {
public: public: