diff options
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(); + + } +} +} |