From 11fc30c02087768c90650c53be4a6e76b5f879e0 Mon Sep 17 00:00:00 2001 From: "Claudius \"keldu\" Holeksa" Date: Thu, 19 Oct 2023 20:46:31 +0200 Subject: core: Fixed compilation issues --- tests/core.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'tests/core.cpp') diff --git a/tests/core.cpp b/tests/core.cpp index 485e601..e8d106b 100644 --- a/tests/core.cpp +++ b/tests/core.cpp @@ -1,8 +1,9 @@ #include #include +#include namespace { -SAW_TEST("Basic ID functionality") { +SAW_TEST("ID functionality") { using namespace saw; struct foo {}; @@ -10,8 +11,40 @@ SAW_TEST("Basic ID functionality") { id b{1}; id c{2}; + /** + * The following doesn't compile, so it's commented out as an example + */ + /** + * struct bar {}; + * + * id 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("ID Map Insert"){ + using namespace saw; + + struct foo {}; + + id_map 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 eov = map.erase(id); + SAW_EXPECT(eov.is_value(), "Erase failed"); + } +} } -- cgit v1.2.3