Tell unittests to use native file convention for EXAMPLE_DIR
authorBrandon King <kingb@caltech.edu>
Sat, 12 Aug 2006 00:18:45 +0000 (00:18 +0000)
committerBrandon King <kingb@caltech.edu>
Sat, 12 Aug 2006 00:18:45 +0000 (00:18 +0000)
C:/stuff/asdf wasn't parsable by boost::filesystem::path I (diane) couldn't
figure out how to specify platform independent paths, so I hacked
the CMakeLists.txt file to shove enough backslashes into define and told
boost::filesystem::path to use native file paths.

alg/test/CMakeLists.txt
alg/test/test_mussa.cpp
alg/test/test_nway.cpp
alg/test/test_sequence.cpp

index 681d4e2df9766dbd0061460cd84f864b5043a638..17e2c26ddd36b798fa833e0d7c68871463846532 100644 (file)
@@ -12,6 +12,10 @@ GET_MUSSA_LINK_FLAGS(ALG_TEST_LDFLAGS)
 # dont you love the number of \ you need to make sure the " shows up in
 # the C compiler?
 SET(EXAMPLE_DIR ${CMAKE_SOURCE_DIR}/examples)
+IF(WIN32)
+  STRING(REGEX REPLACE "/" "\\\\\\\\\\\\\\\\" EXAMPLE_DIR ${EXAMPLE_DIR})
+ENDIF(WIN32)
+
 SET_SOURCE_FILES_PROPERTIES(
   ${SOURCES} 
   COMPILE_FLAGS "-DEXAMPLE_DIR=\\\"${EXAMPLE_DIR}\\\" ${ALG_TEST_CFLAGS}"
index 7340feb86e7609bda2c606e1eeb300e354b1ca70..3a850367f1d9b109a1f23cde12ac3285a05b7081 100644 (file)
@@ -90,7 +90,7 @@ BOOST_AUTO_TEST_CASE ( empty_mussa_set_threshold )
 
 BOOST_AUTO_TEST_CASE( mussa_load_mupa )
 {
-  fs::path mupa_path(EXAMPLE_DIR);
+  fs::path mupa_path(EXAMPLE_DIR, fs::native);
   fs::path result_path = fs::initial_path() / "mck3test_w30_t20";
   mupa_path /= "mck3test.mupa";
 
@@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE( mussa_load_mupa )
 BOOST_AUTO_TEST_CASE( mussa_load_full_path )
 {
   Mussa m1;
-  fs::path full_path(fs::path(EXAMPLE_DIR) / "mck3test.mupa");
+  fs::path full_path(fs::path(EXAMPLE_DIR, fs::native) / "mck3test.mupa");
   m1.load_mupa_file( full_path );
   m1.analyze();
 
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE( mussa_load_full_path )
 
 BOOST_AUTO_TEST_CASE( mussa_load_analysis )
 {
-  fs::path example_dir(EXAMPLE_DIR);
+  fs::path example_dir(EXAMPLE_DIR, fs::native);
   Mussa m1;
   m1.load_mupa_file( example_dir / "mck3test.mupa" );
   m1.analyze();
index 22c84dd712a556f7609d8bee64e884c8725f67f9..6c4704cc9c18cf45f18974710965154c9e9e154a 100644 (file)
@@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE( nway_test )
 
 BOOST_AUTO_TEST_CASE( nway_refine )
 {
-  fs::path mupa_path( EXAMPLE_DIR );
+  fs::path mupa_path( EXAMPLE_DIR, fs::native );
   mupa_path /= "mck3test.mupa";
   Mussa m1;
   m1.load_mupa_file( mupa_path );
index 21f3682f610af8acf3eadf66e2646fdf0c51605f..11beace88500dfce8d95db24a5d0d53970188e3e 100644 (file)
@@ -97,7 +97,7 @@ BOOST_AUTO_TEST_CASE( subseq_names )
 //! Can we load data from a file
 BOOST_AUTO_TEST_CASE( sequence_load )
 {
-  fs::path seq_path(fs::path(EXAMPLE_DIR)/ "seq" );
+  fs::path seq_path(fs::path(EXAMPLE_DIR, fs::native)/ "seq");
   seq_path /=  "human_mck_pro.fa";
   Sequence s;
   s.load_fasta(seq_path);
@@ -212,7 +212,7 @@ BOOST_AUTO_TEST_CASE( annotation_load_no_species_name )
 // have fasta headers it crashes. 
 BOOST_AUTO_TEST_CASE( sequence_past_end ) 
 {
-  fs::path seq_path(fs::path(EXAMPLE_DIR)/ "seq" );
+  fs::path seq_path(fs::path(EXAMPLE_DIR, fs::native)/ "seq" );
   seq_path /=  "misformated_seq.fa";
   Sequence s;
   BOOST_CHECK_THROW( s.load_fasta(seq_path), mussa_load_error );