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
#define FAILURE_H
#pragma once
#include <string>
@ -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

View File

@ -18,13 +18,13 @@
#include <boost/lexical_cast.hpp>
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);
}

View File

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