From: Brandon King Date: Sat, 12 Aug 2006 00:18:45 +0000 (+0000) Subject: Tell unittests to use native file convention for EXAMPLE_DIR X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=commitdiff_plain;h=fbd5136e8b95367e89b5c13478503276c17c7f33 Tell unittests to use native file convention for EXAMPLE_DIR 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. --- diff --git a/alg/test/CMakeLists.txt b/alg/test/CMakeLists.txt index 681d4e2..17e2c26 100644 --- a/alg/test/CMakeLists.txt +++ b/alg/test/CMakeLists.txt @@ -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}" diff --git a/alg/test/test_mussa.cpp b/alg/test/test_mussa.cpp index 7340feb..3a85036 100644 --- a/alg/test/test_mussa.cpp +++ b/alg/test/test_mussa.cpp @@ -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(); diff --git a/alg/test/test_nway.cpp b/alg/test/test_nway.cpp index 22c84dd..6c4704c 100644 --- a/alg/test/test_nway.cpp +++ b/alg/test/test_nway.cpp @@ -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 ); diff --git a/alg/test/test_sequence.cpp b/alg/test/test_sequence.cpp index 21f3682..11beace 100644 --- a/alg/test/test_sequence.cpp +++ b/alg/test/test_sequence.cpp @@ -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 );