diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-05-27 17:01:58 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-05-27 17:01:58 +0100 |
| commit | 14fa24a1aabda7925f4842ab7f7e13c1798182a4 (patch) | |
| tree | f766ce71fb4a8dbc958f599e04c9ceaf21aef2a9 /test/test.cc | |
| parent | bc419bd953dc31184aa3f3a6a3c9b8693bc34b7c (diff) | |
Use boost filesystem.
Diffstat (limited to 'test/test.cc')
| -rw-r--r-- | test/test.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/test.cc b/test/test.cc index feeba36..f6714af 100644 --- a/test/test.cc +++ b/test/test.cc @@ -20,6 +20,7 @@ #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE libsub_test #include <boost/test/unit_test.hpp> +#include <boost/filesystem.hpp> #include <fstream> #include <string> @@ -28,7 +29,7 @@ using std::cerr; using std::ifstream; using std::getline; -string private_test; +boost::filesystem::path private_test; struct TestConfig { @@ -45,17 +46,18 @@ struct TestConfig BOOST_GLOBAL_FIXTURE (TestConfig); void -check_text (string a, string b) +check_text (boost::filesystem::path a, boost::filesystem::path b) { - if (access (a.c_str(), F_OK) == -1) { + if (!boost::filesystem::exists (a)) { cerr << "File not found: " << a << "\n"; } - if (access (b.c_str(), F_OK) == -1) { + if (!boost::filesystem::exists (b)) { cerr << "File not found: " << b << "\n"; } - BOOST_CHECK_EQUAL (access (a.c_str(), F_OK), 0); + BOOST_CHECK (boost::filesystem::exists (a)); + BOOST_CHECK (boost::filesystem::exists (b)); ifstream p (a.c_str ()); ifstream q (b.c_str ()); |
