diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-15 16:38:08 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2017-09-15 16:38:08 +0200 |
commit | aa31a06235496c0d808e57c8ce914cb4b640bc6e (patch) | |
tree | 33385e828ddca0b2857bac9e3dac4dd3723a3eee /tests/test_AstraObjectManager.cpp | |
parent | f6aa2db83dfea89f9d2cfc6fcbd3da141ee77e02 (diff) | |
parent | 00a1c6118b2d64b867c8e640c295462bcccfc7c9 (diff) | |
download | astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.gz astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.bz2 astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.tar.xz astra-aa31a06235496c0d808e57c8ce914cb4b640bc6e.zip |
Merge branch 'master' into parallel_vec
Diffstat (limited to 'tests/test_AstraObjectManager.cpp')
-rw-r--r-- | tests/test_AstraObjectManager.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/tests/test_AstraObjectManager.cpp b/tests/test_AstraObjectManager.cpp index 893efb9..39652f1 100644 --- a/tests/test_AstraObjectManager.cpp +++ b/tests/test_AstraObjectManager.cpp @@ -1,13 +1,13 @@ /* ----------------------------------------------------------------------- -Copyright 2012 iMinds-Vision Lab, University of Antwerp +Copyright: 2010-2016, iMinds-Vision Lab, University of Antwerp + 2014-2016, CWI, Amsterdam -Contact: astra@ua.ac.be -Website: http://astra.ua.ac.be +Contact: astra@uantwerpen.be +Website: http://www.astra-toolbox.com/ +This file is part of the ASTRA Toolbox. -This file is part of the -All Scale Tomographic Reconstruction Antwerp Toolbox ("ASTRA Toolbox"). The ASTRA Toolbox is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,29 +23,43 @@ You should have received a copy of the GNU General Public License along with the ASTRA Toolbox. If not, see <http://www.gnu.org/licenses/>. ----------------------------------------------------------------------- -$Id$ */ - #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> #include <boost/test/auto_unit_test.hpp> #include "astra/AstraObjectManager.h" +struct TestT { + TestT(int _x) : x(_x) { } + bool operator==(int _x) const { return x == _x; } + + int x; + bool isInitialized() const { return true; } + std::string description() const { return ""; } +}; + namespace astra { -DEFINE_SINGLETON(CAstraObjectManager<int>); + +class CTestManager : public Singleton<CTestManager>, public CAstraObjectManager<TestT> +{ + virtual std::string getType() const { return "test"; } +}; + +DEFINE_SINGLETON(CTestManager); + } BOOST_AUTO_TEST_CASE( testAstraObjectManager ) { - astra::CAstraObjectManager<int> man; + astra::CTestManager &man = astra::CTestManager::getSingleton(); - int i1 = man.store(new int(1)); + int i1 = man.store(new TestT(1)); BOOST_REQUIRE(man.hasIndex(i1)); BOOST_CHECK(*(man.get(i1)) == 1); - int i2 = man.store(new int(2)); + int i2 = man.store(new TestT(2)); BOOST_REQUIRE(man.hasIndex(i2)); BOOST_CHECK(*(man.get(i1)) == 1); BOOST_CHECK(*(man.get(i2)) == 2); @@ -55,12 +69,12 @@ BOOST_AUTO_TEST_CASE( testAstraObjectManager ) BOOST_CHECK(!man.hasIndex(i1)); BOOST_REQUIRE(man.hasIndex(i2)); - int i3 = man.store(new int(3)); + int i3 = man.store(new TestT(3)); BOOST_REQUIRE(man.hasIndex(i3)); BOOST_CHECK(*(man.get(i2)) == 2); BOOST_CHECK(*(man.get(i3)) == 3); - int* pi4 = new int(4); + TestT* pi4 = new TestT(4); int i4 = man.store(pi4); BOOST_REQUIRE(man.hasIndex(i4)); BOOST_CHECK(*(man.get(i2)) == 2); |