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 | |
parent | 9ce4eb86a9571cc025d058ca8433c19b9b393a87 (diff) |
core,tests: Fixed include file and implemented tree container
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codec.cpp | 2 | ||||
-rw-r--r-- | tests/tree.cpp | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/tests/codec.cpp b/tests/codec.cpp index 439332a..f3e27f5 100644 --- a/tests/codec.cpp +++ b/tests/codec.cpp @@ -1,7 +1,7 @@ #include <forstio/test/suite.h> #include <forstio/codec/data.h> #include <forstio/codec/simple.h> -#include <forstio/codec/rpc.h> +#include <forstio/codec/interface.h> #include <iostream> 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(); + + } +} +} |