00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/common/DirectoryTreeUnitTest.cpp $ 00003 // $Id: DirectoryTreeUnitTest.cpp 479 2011-06-05 04:04:54Z 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 DirectoryTree class. 00018 00019 #include <boost/test/unit_test.hpp> 00020 #include "torc/common/DirectoryTree.hpp" 00021 00022 namespace torc { 00023 namespace common { 00024 00025 BOOST_AUTO_TEST_SUITE(common) 00026 00027 /// \brief Unit test for the directory tree. 00028 BOOST_AUTO_TEST_CASE(DirectoryTreeUnitTest) { 00029 // look up the command line arguments 00030 int& argc = boost::unit_test::framework::master_test_suite().argc; 00031 char**& argv = boost::unit_test::framework::master_test_suite().argv; 00032 // make sure that we at least have the name under which we were invoked 00033 BOOST_REQUIRE(argc >= 1); 00034 00035 // functions tested: 00036 // DirectoryTree(const char* argv0); 00037 // resolve symbolic links if applicable 00038 DirectoryTree directoryTree(argv[0]); 00039 00040 // functions tested: 00041 // static const boost::filesystem::path& getRelativePath(void); 00042 // static const boost::filesystem::path& getWorkingPath(void); 00043 // static const boost::filesystem::path& getExecutablePath(void); 00044 // static const boost::filesystem::path& getDevicesPath(void); 00045 // static const boost::filesystem::path& getLogPath(void); 00046 BOOST_CHECK(boost::filesystem::exists(directoryTree.getRelativePath())); 00047 BOOST_CHECK(boost::filesystem::exists(directoryTree.getWorkingPath())); 00048 BOOST_CHECK(boost::filesystem::exists(directoryTree.getExecutablePath())); 00049 BOOST_CHECK(boost::filesystem::exists(directoryTree.getDevicesPath())); 00050 BOOST_CHECK(boost::filesystem::exists(directoryTree.getLogPath())); 00051 } 00052 00053 BOOST_AUTO_TEST_SUITE_END() 00054 00055 } // namespace common 00056 } // namespace torc