From 467d8d52ffda8b5d520ee0eb1e42125bdb533ff4 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Sat, 13 Dec 2014 12:33:07 +0100 Subject: started to refactor Managed package --- test/core/ManagedContainersTest.cpp | 80 ------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 test/core/ManagedContainersTest.cpp (limited to 'test/core/ManagedContainersTest.cpp') diff --git a/test/core/ManagedContainersTest.cpp b/test/core/ManagedContainersTest.cpp deleted file mode 100644 index 3abbd4d..0000000 --- a/test/core/ManagedContainersTest.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - Ousía - Copyright (C) 2014, 2015 Benjamin Paaßen, Andreas Stöckel - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -#include - -#include - -#include -#include - -#include "TestManaged.hpp" - -namespace ousia { - -TEST(ManagedVector, managedVector) -{ - // TODO: This test is highly incomplete - - constexpr int nElem = 16; - std::array a; - - Manager mgr(1); - { - Rooted root{new Managed{mgr}}; - - std::vector elems; - for (int i = 0; i < nElem; i++) { - elems.push_back(new TestManaged{mgr, a[i]}); - } - - for (bool v : a) { - ASSERT_TRUE(v); - } - - ManagedVector v(root, elems); - - // Remove the last element from the list. It should be garbage collected. - v.pop_back(); - ASSERT_FALSE(a[nElem - 1]); - - // Insert a new element into the list. - v.push_back(new TestManaged{mgr, a[nElem - 1]}); - ASSERT_TRUE(a[nElem - 1]); - - // Erase element 10 - { - auto it = v.find(elems[10]); - ASSERT_TRUE(it != v.end()); - v.erase(it); - ASSERT_FALSE(a[10]); - } - - // Erase element 3 - 5 - v.erase(v.find(elems[3]), v.find(elems[5])); - ASSERT_FALSE(a[3] || a[4]); - ASSERT_TRUE(a[5]); - } - - for (bool v : a) { - ASSERT_FALSE(v); - } -} - -} - -- cgit v1.2.3