diff options
author | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-11-05 19:24:20 +0100 |
---|---|---|
committer | Claudius "keldu" Holeksa <mail@keldu.de> | 2023-11-05 19:24:20 +0100 |
commit | c5607d106449cc3c8680e95ec8595370996d5fb1 (patch) | |
tree | cac339f6b727ee10df11a9f3ed3c59c11666dea3 /tests/tree.cpp | |
parent | 9ce4eb86a9571cc025d058ca8433c19b9b393a87 (diff) |
core,tests: Fixed include file and implemented tree container
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(); + + } +} +} |