summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/dcp_to_stl_text_test.cc8
-rw-r--r--test/stl_binary_reader_test.cc4
-rw-r--r--test/test.cc12
-rw-r--r--test/test.h7
4 files changed, 17 insertions, 14 deletions
diff --git a/test/dcp_to_stl_text_test.cc b/test/dcp_to_stl_text_test.cc
index b96fc6c..47381cc 100644
--- a/test/dcp_to_stl_text_test.cc
+++ b/test/dcp_to_stl_text_test.cc
@@ -29,17 +29,19 @@ using std::ofstream;
BOOST_AUTO_TEST_CASE (dcp_to_stl_text_test)
{
+ using boost::filesystem::path;
+
if (private_test.empty ()) {
return;
}
- string const p = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
+ path p = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.xml";
ifstream f (p.c_str ());
sub::DCPReader r (f);
- string const q = "build/test/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ path const q = path ("build") / path ("test") / path ("fd586c30-6d38-48f2-8241-27359acf184c_sub.stl");
ofstream g (q.c_str ());
sub::STLTextWriter w (r.subtitles (), 72 * 11, 24, g);
- string const c = private_test + "/fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
+ path const c = private_test / "fd586c30-6d38-48f2-8241-27359acf184c_sub.stl";
g.close ();
check_text (q, c);
}
diff --git a/test/stl_binary_reader_test.cc b/test/stl_binary_reader_test.cc
index 06b01ed..2c301ee 100644
--- a/test/stl_binary_reader_test.cc
+++ b/test/stl_binary_reader_test.cc
@@ -34,8 +34,8 @@ BOOST_AUTO_TEST_CASE (stl_binary_reader_test)
return;
}
- string p = private_test + "/Vampire_Academy_24fps_Reel_6_DE_FR.stl";
- ifstream f (p.c_str ());
+ boost::filesystem::path p = private_test / "Vampire_Academy_24fps_Reel_6_DE_FR.stl";
+ ifstream f (p.string().c_str ());
sub::STLBinaryReader r (f);
}
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 ());
diff --git a/test/test.h b/test/test.h
index 8bc6e3d..9d43439 100644
--- a/test/test.h
+++ b/test/test.h
@@ -18,9 +18,8 @@
*/
#include <string>
+#include <boost/filesystem.hpp>
-using std::string;
+extern boost::filesystem::path private_test;
-extern string private_test;
-
-void check_text (std::string a, std::string b);
+void check_text (boost::filesystem::path a, boost::filesystem::path b);