diff options
Diffstat (limited to 'tests/tree.cpp')
-rw-r--r-- | tests/tree.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/tree.cpp b/tests/tree.cpp new file mode 100644 index 0000000..de6bda6 --- /dev/null +++ b/tests/tree.cpp @@ -0,0 +1,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(); + + } +} +} |