-
Notifications
You must be signed in to change notification settings - Fork 767
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d80fa24
Showing
163 changed files
with
20,617 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Frank Dellaert | ||
Christian Potthast | ||
Alireza Fathi | ||
Carlos Nieto |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The GTSAM library is not (yet) open source: the software was created | ||
by Frank Dellaert and his students, but the copyright is legally owned | ||
by the Georgia Board Of Regents. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
|
||
|
||
#include "Failure.h" | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
|
||
Failure::Failure (const SimpleString& theTestName, | ||
const SimpleString& theFileName, | ||
long theLineNumber, | ||
const SimpleString& theCondition) | ||
: message (theCondition), | ||
testName (theTestName), | ||
fileName (theFileName), | ||
lineNumber (theLineNumber) | ||
{ | ||
} | ||
|
||
|
||
Failure::Failure (const SimpleString& theTestName, | ||
const SimpleString& theFileName, | ||
long theLineNumber, | ||
const SimpleString& expected, | ||
const SimpleString& actual) | ||
: testName (theTestName), | ||
fileName (theFileName), | ||
lineNumber (theLineNumber) | ||
{ | ||
char *part1 = "expected "; | ||
char *part3 = " but was: "; | ||
|
||
char *stage = new char [strlen (part1) | ||
+ expected.size () | ||
+ strlen (part3) | ||
+ actual.size () | ||
+ 1]; | ||
|
||
sprintf(stage, "%s%s%s%s", | ||
part1, | ||
expected.asCharString(), | ||
part3, | ||
actual.asCharString()); | ||
|
||
message = SimpleString(stage); | ||
|
||
delete stage; | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// FAILURE.H | ||
// | ||
// Failure is a class which holds information pertaining to a specific | ||
// test failure. The stream insertion operator is overloaded to allow easy | ||
// display. | ||
// | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
#ifndef FAILURE_H | ||
#define FAILURE_H | ||
|
||
#include "SimpleString.h" | ||
|
||
|
||
class Failure | ||
{ | ||
|
||
public: | ||
Failure (const SimpleString& theTestName, | ||
const SimpleString& theFileName, | ||
long theLineNumber, | ||
const SimpleString& theCondition); | ||
|
||
Failure (const SimpleString& theTestName, | ||
const SimpleString& theFileName, | ||
long theLineNumber, | ||
const SimpleString& expected, | ||
const SimpleString& actual); | ||
|
||
SimpleString message; | ||
SimpleString testName; | ||
SimpleString fileName; | ||
long lineNumber; | ||
}; | ||
|
||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Makefile to compile the unit test library, will end up in $(LIBDIR) | ||
|
||
.PHONY: all install clean | ||
|
||
all: libCppUnitLite.a | ||
|
||
CC=gcc | ||
CXX=gcc | ||
CPP=gcc | ||
CXXFLAGS += -O2 | ||
|
||
sources = $(shell ls *.cpp) | ||
objects = $(sources:.cpp=.o) | ||
|
||
library = libCppUnitLite.a | ||
|
||
$(library): $(objects) | ||
ar crsv $@ $(objects) | ||
ranlib $(library) | ||
|
||
clean: | ||
rm -f *.o *.*~ $(library) | ||
|
||
check: | ||
echo 'no check for CppUnitLite' | ||
|
||
distdir: | ||
|
||
install: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
|
||
|
||
#include "SimpleString.h" | ||
#include <string.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
|
||
|
||
static const int DEFAULT_SIZE = 20; | ||
|
||
SimpleString::SimpleString () | ||
: buffer(new char [1]) | ||
{ | ||
buffer [0] = '\0'; | ||
} | ||
|
||
|
||
SimpleString::SimpleString (const char *otherBuffer) | ||
: buffer (new char [strlen (otherBuffer) + 1]) | ||
{ | ||
strcpy (buffer, otherBuffer); | ||
} | ||
|
||
SimpleString::SimpleString (const SimpleString& other) | ||
{ | ||
buffer = new char [other.size() + 1]; | ||
strcpy(buffer, other.buffer); | ||
} | ||
|
||
|
||
SimpleString SimpleString::operator= (const SimpleString& other) | ||
{ | ||
delete buffer; | ||
buffer = new char [other.size() + 1]; | ||
strcpy(buffer, other.buffer); | ||
return *this; | ||
} | ||
|
||
|
||
char *SimpleString::asCharString () const | ||
{ | ||
return buffer; | ||
} | ||
|
||
int SimpleString::size() const | ||
{ | ||
return strlen (buffer); | ||
} | ||
|
||
SimpleString::~SimpleString () | ||
{ | ||
delete [] buffer; | ||
} | ||
|
||
|
||
bool operator== (const SimpleString& left, const SimpleString& right) | ||
{ | ||
return !strcmp (left.asCharString (), right.asCharString ()); | ||
} | ||
|
||
|
||
SimpleString StringFrom (bool value) | ||
{ | ||
char buffer [sizeof ("false") + 1]; | ||
sprintf (buffer, "%s", value ? "true" : "false"); | ||
return SimpleString(buffer); | ||
} | ||
|
||
SimpleString StringFrom (const char *value) | ||
{ | ||
return SimpleString(value); | ||
} | ||
|
||
SimpleString StringFrom (long value) | ||
{ | ||
char buffer [DEFAULT_SIZE]; | ||
sprintf (buffer, "%ld", value); | ||
|
||
return SimpleString(buffer); | ||
} | ||
|
||
SimpleString StringFrom (double value) | ||
{ | ||
char buffer [DEFAULT_SIZE]; | ||
sprintf (buffer, "%lf", value); | ||
|
||
return SimpleString(buffer); | ||
} | ||
|
||
SimpleString StringFrom (const SimpleString& value) | ||
{ | ||
return SimpleString(value); | ||
} | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
/////////////////////////////////////////////////////////////////////////////// | ||
// | ||
// SIMPLESTRING.H | ||
// | ||
// One of the design goals of CppUnitLite is to compilation with very old C++ | ||
// compilers. For that reason, I've added a simple string class that provides | ||
// only the operations needed in CppUnitLite. | ||
// | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef SIMPLE_STRING | ||
#define SIMPLE_STRING | ||
|
||
|
||
|
||
class SimpleString | ||
{ | ||
friend bool operator== (const SimpleString& left, const SimpleString& right); | ||
|
||
public: | ||
SimpleString (); | ||
SimpleString (const char *value); | ||
SimpleString (const SimpleString& other); | ||
~SimpleString (); | ||
|
||
SimpleString operator= (const SimpleString& other); | ||
|
||
char *asCharString () const; | ||
int size() const; | ||
|
||
private: | ||
char *buffer; | ||
}; | ||
|
||
|
||
|
||
SimpleString StringFrom (bool value); | ||
SimpleString StringFrom (const char *value); | ||
SimpleString StringFrom (long value); | ||
SimpleString StringFrom (double value); | ||
SimpleString StringFrom (const SimpleString& other); | ||
|
||
|
||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
|
||
|
||
#include "Test.h" | ||
#include "TestRegistry.h" | ||
#include "TestResult.h" | ||
#include "Failure.h" | ||
|
||
|
||
Test::Test (const SimpleString& testName) | ||
: name_ (testName) | ||
{ | ||
TestRegistry::addTest (this); | ||
} | ||
|
||
|
||
|
||
Test *Test::getNext() const | ||
{ | ||
return next_; | ||
} | ||
|
||
void Test::setNext(Test *test) | ||
{ | ||
next_ = test; | ||
} | ||
|
||
bool Test::check(long expected, long actual, TestResult& result, const SimpleString& fileName, long lineNumber) | ||
{ | ||
if (expected == actual) | ||
return true; | ||
result.addFailure ( | ||
Failure ( | ||
name_, | ||
StringFrom (__FILE__), | ||
__LINE__, | ||
StringFrom (expected), | ||
StringFrom (actual))); | ||
|
||
return false; | ||
|
||
} | ||
|
||
|
||
bool Test::check(const SimpleString& expected, const SimpleString& actual, TestResult& result, const SimpleString& fileName, long lineNumber) | ||
{ | ||
if (expected == actual) | ||
return true; | ||
result.addFailure ( | ||
Failure ( | ||
name_, | ||
StringFrom (__FILE__), | ||
__LINE__, | ||
expected, | ||
actual)); | ||
|
||
return false; | ||
|
||
} | ||
|
Oops, something went wrong.