diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core.cpp | 67 | ||||
-rw-r--r-- | tests/tree.cpp | 24 |
2 files changed, 0 insertions, 91 deletions
diff --git a/tests/core.cpp b/tests/core.cpp deleted file mode 100644 index 281cca6..0000000 --- a/tests/core.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <forstio/test/suite.h> -#include <forstio/core/id.h> -#include <forstio/core/id_map.h> -#include <forstio/core/string_literal.h> - -namespace { -SAW_TEST("ID functionality") { - using namespace saw; - struct foo {}; - - id<foo> a{1}; - id<foo> b{1}; - id<foo> c{2}; - - /** - * The following doesn't compile, so it's commented out as an example - */ - /** - * struct bar {}; - * - * id<bar> d{1}; - * - * SAW_EXPECT(a == d, "Shouldn't compile"); - */ - - SAW_EXPECT(a == b, "Should be equal"); - SAW_EXPECT(a != c, "Shouldn't be equal"); - SAW_EXPECT(b != c, "Shouldn't be equal"); - SAW_EXPECT(a.get_value() == 1, "Lost original value"); -} - -SAW_TEST("String Literal Append"){ - using namespace saw; - - constexpr string_literal a = "foo"; - constexpr string_literal b = "bar"; - constexpr string_literal c = a+b; - - SAW_EXPECT(c == "foobar", "CT String sum is not \"foobar\""); -} - -SAW_TEST("ID Map Insert"){ - using namespace saw; - - struct foo {}; - - id_map<foo> map; - { - auto eoid = map.insert(foo{}); - SAW_EXPECT(eoid.is_value(), "First insert failed"); - - auto& id = eoid.get_value(); - - auto eoid_2 = map.insert(foo{}); - SAW_EXPECT(eoid_2.is_value(), "Second Insert failed"); - auto& id_2 = eoid_2.get_value(); - - SAW_EXPECT(id != id_2, "Shouldn't be equal"); - - auto eov = map.erase(id); - SAW_EXPECT(eov.is_value(), "Erase failed"); - - auto eov_2 = map.erase(id); - SAW_EXPECT(eov_2.is_error(), "This is a double free"); - } -} -} diff --git a/tests/tree.cpp b/tests/tree.cpp deleted file mode 100644 index 2515ee9..0000000 --- a/tests/tree.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include <forstio/test/suite.h> -#include <forstio/core/tree.h> - -namespace { -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(); - - auto& inner_tr = tr.at(index); - - auto eov2 = inner_tr.get_tree().add(420); - SAW_EXPECT(eov2.is_value(), "Didn't manage to add to inner tree"); - } -} -} |