25 using namespace gtsam;
27 typedef pair<size_t, size_t>
Range;
31 static std::stringstream
ss;
32 static string x1(
"x1"),
x2(
"x2"),
x3(
"x3"),
x4(
"x4"),
x5(
"x5");
41 void g(
const string&
key,
int i) {
45 int add(
const string& k,
int v,
int a) {
99 CHECK(!tree2.same(tree1))
104 CHECK(!tree3.same(tree1))
105 CHECK(!tree3.same(tree2))
109 CHECK(!tree4.same(tree1))
114 CHECK(tree5.same(tree1))
115 CHECK(!tree5.same(tree2))
125 CHECK(
ss.str() == string(
"x1x2x3x4x5"));
135 CHECK(it->second == 1)
148 for (
const KeyInt&
p : tree) sum +=
p.second;
153 std::list<KeyInt> actual;
154 copy (tree.begin(),tree.end(),back_inserter(actual));
173 list<RangeTree::value_type>
expected;
175 for (
int i = 1;
i <=
N;
i++) {
178 tree = tree.
add(key, value);
181 expected.emplace_back(key, value);
188 list<RangeTree::value_type> actual;
190 CHECK(actual==expected)
193 for (
int i = N;
i >=
N;
i--) {
const gtsam::Symbol key('X', 0)
bool mem(const KEY &x) const
static int runAllTests(TestResult &result)
int f(const string &key, const Range &range)
BTree< string, int > IntTree
purely functional binary tree
void g(const string &key, int i)
Const iterator Not trivial: iterator keeps a stack to indicate current path from root_.
ACC fold(std::function< ACC(const KEY &, const VALUE &, const ACC &)> f, const ACC &a) const
const_iterator begin() const
Array< int, Dynamic, 1 > v
BTree< string, Range > RangeTree
BTree remove(const KEY &x) const
pair< size_t, size_t > Range
static std::stringstream ss
#define LONGS_EQUAL(expected, actual)
BTree add(const value_type &xd) const
Double_ range(const Point2_ &p, const Point2_ &q)
BTree< KEY, TO > map(std::function< TO(const KEY &, const VALUE &)> f) const
void iter(std::function< void(const KEY &, const VALUE &)> f) const
const_iterator end() const
bool equality(const Errors &actual, const Errors &expected, double tol)
const VALUE & find(const KEY &k) const
int add(const string &k, int v, int a)
pair< string, int > KeyInt
bool same(const BTree &other) const