00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/physical/ProgenitorUnitTest.cpp $ 00003 // $Id: ProgenitorUnitTest.cpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Unit test for the Progenitor class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/physical/Factory.hpp" 00021 #include "torc/physical/Progenitor.hpp" 00022 00023 namespace torc { 00024 namespace physical { 00025 00026 BOOST_AUTO_TEST_SUITE(physical) 00027 00028 /// \cond OMIT_FROM_DOXYGEN 00029 class A : public Progenitor<class A> {}; 00030 /// \endcond 00031 00032 /// \brief Unit test for the Progenitor class. 00033 BOOST_AUTO_TEST_CASE(ProgenitorUnitTest) { 00034 // functions tested: 00035 // [null constructor] 00036 // void setSelfWeakPtr(WeakPtrType inSelfPtr); 00037 // const WeakPtrType& getSelfWeakPtr(void) const; 00038 typedef Progenitor<A> progenitor_t; 00039 progenitor_t::SharedPtrType progenitorPtr(new A()); 00040 BOOST_REQUIRE(progenitorPtr.get() != 0); 00041 progenitorPtr->setSelfWeakPtr(progenitorPtr); 00042 BOOST_CHECK(progenitorPtr->getSelfWeakPtr().lock() == progenitorPtr); 00043 } 00044 00045 BOOST_AUTO_TEST_SUITE_END() 00046 00047 } // namespace physical 00048 } // namespace torc