Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
Enumerations
a
c
d
e
f
g
i
k
l
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Hierarchy
Class Members
All
!
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
!
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
f
k
l
m
n
o
p
r
s
t
v
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
e
g
h
i
l
m
n
o
p
r
s
t
u
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
x
z
Enumerations
Enumerator
b
c
e
f
g
i
l
m
n
o
p
r
s
t
u
v
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
gtsam
symbolic
tests
testSymbolicConditional.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
19
#include <
CppUnitLite/TestHarness.h
>
20
#include <
gtsam/base/TestableAssertions.h
>
21
#include <
gtsam/symbolic/SymbolicConditional.h
>
22
23
using namespace
std
;
24
using namespace
gtsam
;
25
26
/* ************************************************************************* */
27
TEST
(
SymbolicConditional
,
empty
)
28
{
29
SymbolicConditional
c0;
30
LONGS_EQUAL
(0, (
long
)c0.
nrFrontals
());
31
LONGS_EQUAL
(0, (
long
)c0.
nrParents
());
32
}
33
34
/* ************************************************************************* */
35
TEST
(
SymbolicConditional
, noParents )
36
{
37
SymbolicConditional
c0(0);
38
LONGS_EQUAL
(1, (
long
)c0.
nrFrontals
());
39
LONGS_EQUAL
(0, (
long
)c0.
nrParents
());
40
}
41
42
/* ************************************************************************* */
43
TEST
(
SymbolicConditional
, oneParents )
44
{
45
SymbolicConditional
c0(0,1);
46
LONGS_EQUAL
(1, (
long
)c0.
nrFrontals
());
47
LONGS_EQUAL
(1, (
long
)c0.
nrParents
());
48
}
49
50
/* ************************************************************************* */
51
TEST
(
SymbolicConditional
, twoParents )
52
{
53
SymbolicConditional
c0(0,1,2);
54
LONGS_EQUAL
(1, (
long
)c0.
nrFrontals
());
55
LONGS_EQUAL
(2, (
long
)c0.
nrParents
());
56
}
57
58
/* ************************************************************************* */
59
TEST
(
SymbolicConditional
, threeParents )
60
{
61
SymbolicConditional
c0(0,1,2,3);
62
LONGS_EQUAL
(1, (
long
)c0.
nrFrontals
());
63
LONGS_EQUAL
(3, (
long
)c0.
nrParents
());
64
}
65
66
/* ************************************************************************* */
67
TEST
(
SymbolicConditional
, fourParents )
68
{
69
auto
c0 = SymbolicConditional::FromKeys(
KeyVector
{0, 1, 2, 3, 4}, 1);
70
LONGS_EQUAL
(1, (
long
)c0.nrFrontals());
71
LONGS_EQUAL
(4, (
long
)c0.nrParents());
72
}
73
74
/* ************************************************************************* */
75
TEST
(
SymbolicConditional
, FromRange )
76
{
77
auto
c0 = std::make_shared<SymbolicConditional>(
78
SymbolicConditional::FromKeys(
KeyVector
{1, 2, 3, 4, 5}, 2));
79
LONGS_EQUAL
(2, (
long
)c0->nrFrontals());
80
LONGS_EQUAL
(3, (
long
)c0->nrParents());
81
}
82
83
/* ************************************************************************* */
84
TEST
(
SymbolicConditional
, Constructors)
85
{
86
SymbolicConditional
expected
(3, 4);
87
88
SymbolicConditional
actual1 = SymbolicConditional::FromKeys(
expected
.keys(), 1);
89
SymbolicConditional
actual2 = SymbolicConditional::FromIterators(
expected
.begin(),
expected
.end(), 1);
90
SymbolicConditional
actual3 = *SymbolicConditional::FromKeysShared(
expected
.keys(), 1);
91
SymbolicConditional
actual4 = *SymbolicConditional::FromIteratorsShared(
expected
.begin(),
expected
.end(), 1);
92
93
EXPECT
(
assert_equal
(
expected
, actual1));
94
EXPECT
(
assert_equal
(
expected
, actual2));
95
EXPECT
(
assert_equal
(
expected
, actual3));
96
EXPECT
(
assert_equal
(
expected
, actual4));
97
}
98
99
/* ************************************************************************* */
100
TEST
(
SymbolicConditional
,
equals
)
101
{
102
SymbolicConditional
c0(0, 1, 2),
c1
(0, 1, 2),
c2
(1, 2, 3), c3(3,4);
103
CHECK
(c0.equals(
c1
));
104
CHECK
(
c1
.equals(c0));
105
CHECK
(!c0.equals(
c2
));
106
CHECK
(!
c2
.equals(c0));
107
CHECK
(!c0.equals(c3));
108
CHECK
(!c3.
equals
(c0));
109
}
110
111
/* ************************************************************************* */
112
int
main
() {
113
TestResult
tr;
114
return
TestRegistry::runAllTests
(tr);
115
}
116
/* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition:
TestRegistry.cpp:27
EXPECT
#define EXPECT(condition)
Definition:
Test.h:150
TestHarness.h
main
int main()
Definition:
testSymbolicConditional.cpp:112
gtsam::KeyVector
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
Definition:
Key.h:92
SymbolicConditional.h
TestableAssertions.h
Provides additional testing facilities for common data structures.
c1
static double c1
Definition:
airy.c:54
cholesky::expected
Matrix expected
Definition:
testMatrix.cpp:916
gtsam::SymbolicConditional::equals
bool equals(const This &c, double tol=1e-9) const
Definition:
SymbolicConditional.cpp:31
gtsam::equals
Definition:
Testable.h:112
TestResult
Definition:
TestResult.h:26
gtsam::Conditional::nrFrontals
size_t nrFrontals() const
Definition:
Conditional.h:131
TEST
TEST(SymbolicConditional, empty)
Definition:
testSymbolicConditional.cpp:27
gtsam::SymbolicConditional
Definition:
SymbolicConditional.h:36
empty
Definition:
test_copy_move.cpp:19
gtsam
traits
Definition:
SFMdata.h:40
CHECK
#define CHECK(condition)
Definition:
Test.h:108
std
Definition:
BFloat16.h:88
c2
static double c2
Definition:
airy.c:55
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition:
Matrix.cpp:41
gtsam::Conditional::nrParents
size_t nrParents() const
Definition:
Conditional.h:134
LONGS_EQUAL
#define LONGS_EQUAL(expected, actual)
Definition:
Test.h:134
gtsam
Author(s):
autogenerated on Wed Mar 19 2025 03:08:02