Test.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
12 
13 #include "Test.h"
14 #include "TestRegistry.h"
15 #include "TestResult.h"
16 #include "Failure.h"
17 
18 Test::Test (const std::string& testName)
19  : name_ (testName), next_(0), lineNumber_(-1), safeCheck_(true)
20 {
21  TestRegistry::addTest (this);
22 }
23 
24 Test::Test (const std::string& testName, const std::string& filename, long lineNumber, bool safeCheck)
25  : name_(testName), next_(0), filename_(filename), lineNumber_(lineNumber), safeCheck_(safeCheck)
26 {
27  TestRegistry::addTest (this);
28 }
29 
30 
32 {
33  return next_;
34 }
35 
37 {
38  next_ = test;
39 }
40 
41 bool Test::check(long expected, long actual, TestResult& result, const std::string& fileName, long lineNumber)
42 {
43  if (expected == actual)
44  return true;
45  result.addFailure (
46  Failure (
47  name_,
48  std::string(__FILE__),
49  __LINE__,
50  std::to_string(expected),
51  std::to_string(actual)));
52 
53  return false;
54 
55 }
56 
57 
58 bool Test::check(const std::string& expected, const std::string& actual, TestResult& result, const std::string& fileName, long lineNumber)
59 {
60  if (expected == actual)
61  return true;
62  result.addFailure (
63  Failure (
64  name_,
65  std::string(__FILE__),
66  __LINE__,
67  expected,
68  actual));
69 
70  return false;
71 
72 }
73 
TestRegistry::addTest
static void addTest(Test *test)
Definition: TestRegistry.cpp:21
Test::check
bool check(long expected, long actual, TestResult &result, const std::string &fileName, long lineNumber)
Definition: Test.cpp:41
TestResult.h
result
Values result
Definition: OdometryOptimize.cpp:8
Test::name_
std::string name_
Definition: Test.h:52
test
Definition: test.py:1
Failure
Definition: Failure.h:28
Test::next_
Test * next_
Definition: Test.h:53
relicense.filename
filename
Definition: relicense.py:57
test
void test(OptionalJacobian< 2, 3 > H={})
Definition: testOptionalJacobian.cpp:63
cholesky::expected
Matrix expected
Definition: testMatrix.cpp:971
Test::getNext
Test * getNext() const
Definition: Test.cpp:31
TestRegistry.h
Test::setNext
void setNext(Test *test)
Definition: Test.cpp:36
TestResult
Definition: TestResult.h:26
Test.h
Test
Definition: Test.h:30
Failure.h
Test::Test
Test(const std::string &testName)
Definition: Test.cpp:18


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:15:57