blob: de6bda6758dc90b706a41cc25c7cc25fe29f0eb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <forstio/test/suite.h>
#include <forstio/core/tree.h>
namespace {
SAW_TEST("Tree insert"){
using namespace saw;
tree_or<int> troi;
{
// Replace with value
auto eor = troi.replace_tree(5);
SAW_EXPECT(eor.is_value(), "Didn't manage to replace with value");
}
{
// Replace with tree again
auto eor = troi.replace_value(tree<int>{});
SAW_EXPECT(eor.is_value(), "Not a value");
}
}
SAW_TEST("Tree add child"){
using namespace saw;
tree<int> tr;
{
auto eov = tr.add(10);
SAW_EXPECT(eov.is_value(), "Didn't manage to add value");
}
{
auto eov = tr.add();
SAW_EXPECT(eov.is_value(), "Didn't manage to add tree");
std::size_t index = eov.get_value();
}
}
}
|