torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DirectoryTreeUnitTest.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Unit test for DirectoryTree class.
18 
19 #include <boost/test/unit_test.hpp>
21 
22 namespace torc {
23 namespace common {
24 
25 BOOST_AUTO_TEST_SUITE(common)
26 
27 /// \brief Unit test for the directory tree.
28 BOOST_AUTO_TEST_CASE(DirectoryTreeUnitTest) {
29  // look up the command line arguments
30  int& argc = boost::unit_test::framework::master_test_suite().argc;
31  char**& argv = boost::unit_test::framework::master_test_suite().argv;
32  // make sure that we at least have the name under which we were invoked
33  BOOST_REQUIRE(argc >= 1);
34 
35  // functions tested:
36  // DirectoryTree(const char* argv0);
37  // resolve symbolic links if applicable
38  DirectoryTree directoryTree(argv[0]);
39 
40  // functions tested:
41  // static const boost::filesystem::path& getRelativePath(void);
42  // static const boost::filesystem::path& getWorkingPath(void);
43  // static const boost::filesystem::path& getExecutablePath(void);
44  // static const boost::filesystem::path& getDevicesPath(void);
45  // static const boost::filesystem::path& getLogPath(void);
46  BOOST_CHECK(boost::filesystem::exists(directoryTree.getRelativePath()));
47  BOOST_CHECK(boost::filesystem::exists(directoryTree.getWorkingPath()));
48  BOOST_CHECK(boost::filesystem::exists(directoryTree.getExecutablePath()));
49  BOOST_CHECK(boost::filesystem::exists(directoryTree.getDevicesPath()));
50  BOOST_CHECK(boost::filesystem::exists(directoryTree.getLogPath()));
51 }
52 
53 BOOST_AUTO_TEST_SUITE_END()
54 
55 } // namespace common
56 } // namespace torc
static const boost::filesystem::path & getDevicesPath(void)
Returns the absolute path to the family and device database directory.
static const boost::filesystem::path & getLogPath(void)
Returns the absolute path to the log files directory.
Header for the DirectoryTree class.
BOOST_AUTO_TEST_CASE(AnnotatedUnitTest)
Unit test for the Annotated class.
Encapsulation of filesystem paths that are used by the library.
static const boost::filesystem::path & getRelativePath(void)
Returns the relative path from the working directory to the executable home.
static const boost::filesystem::path & getWorkingPath(void)
Returns the absolute path to the working directory.
static const boost::filesystem::path & getExecutablePath(void)
Returns the absolute path to the executable directory.