testEdgeKey.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  * @file testEdgeKey.cpp
14  * @date Oct 24, 2024
15  * @author: Frank Dellaert
16  * @author: Akshay Krishnan
17  */
18 
21 
22 #include <sstream>
23 
24 using namespace std;
25 using namespace gtsam;
26 
27 /* ************************************************************************* */
28 TEST(EdgeKey, Construction) {
29  EdgeKey edge(1, 2);
30  EXPECT(edge.i() == 1);
31  EXPECT(edge.j() == 2);
32 }
33 
34 /* ************************************************************************* */
35 TEST(EdgeKey, Equality) {
36  EdgeKey edge1(1, 2);
37  EdgeKey edge2(1, 2);
38  EdgeKey edge3(2, 3);
39 
40  EXPECT(assert_equal(edge1, edge2));
41  EXPECT(!edge1.equals(edge3));
42 }
43 
44 /* ************************************************************************* */
45 TEST(EdgeKey, StreamOutput) {
46  EdgeKey edge(1, 2);
47  std::ostringstream oss;
48  oss << edge;
49  EXPECT("{1, 2}" == oss.str());
50 }
51 
52 /* ************************************************************************* */
53 int main() {
54  TestResult tr;
55  return TestRegistry::runAllTests(tr);
56 }
57 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
EXPECT
#define EXPECT(condition)
Definition: Test.h:150
TestHarness.h
gtsam::EdgeKey::i
std::uint32_t i() const
Retrieve high 32 bits.
Definition: EdgeKey.h:52
gtsam::EdgeKey::equals
bool equals(const EdgeKey &expected, double tol=0.0) const
Checks if this EdgeKey is equal to another, tolerance is ignored.
Definition: EdgeKey.h:71
TEST
TEST(EdgeKey, Construction)
Definition: testEdgeKey.cpp:28
TestResult
Definition: TestResult.h:26
gtsam::EdgeKey
Definition: EdgeKey.h:25
gtsam
traits
Definition: SFMdata.h:40
std
Definition: BFloat16.h:88
gtsam::EdgeKey::j
std::uint32_t j() const
Retrieve low 32 bits.
Definition: EdgeKey.h:55
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
EdgeKey.h
main
int main()
Definition: testEdgeKey.cpp:53


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:39:51