X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=mussa.git;a=blobdiff_plain;f=alg%2Ftest%2Ftest_flp.cpp;h=54aa76a9ad18d6495ae01c77cf328f4a2c4cc05f;hp=c3c9437a259fc8d68af8861ecf62ad3aae9f5a77;hb=HEAD;hpb=198f7c18fd0b5fa84528e9b28a84269c3a856cc4 diff --git a/alg/test/test_flp.cpp b/alg/test/test_flp.cpp index c3c9437..54aa76a 100644 --- a/alg/test/test_flp.cpp +++ b/alg/test/test_flp.cpp @@ -1,20 +1,32 @@ +#define BOOST_TEST_DYN_LINK +#define BOOST_TEST_MODULE test_flp +#include + #include #include -#include #include #include +namespace fs = boost::filesystem; #include "alg/flp.hpp" #include "alg/sequence.hpp" #include #include +#include "mussa_exceptions.hpp" + BOOST_AUTO_TEST_CASE( flp_simple ) { FLPs f; f.setup(5, 4); + // when we first setup progress should be equal to -1 + // aka FLPs::seqcomp_not_running + BOOST_CHECK_EQUAL( f.progress(), -1 ); f.seqcomp("AAGGTAAGGT", "AAGGTAAGGT", false); + // now that we're done we should be equal to not running again. + // yeah it'd be nice to make a thread test + BOOST_CHECK_EQUAL( f.progress(), -1 ); // are the match_locations correct? for (int i=0; i != f.size(); i++) @@ -79,13 +91,13 @@ BOOST_AUTO_TEST_CASE( flp_reverse_compliment ) Sequence s1("AAAATTTT"); Sequence s2("AACAGGGG"); f1.setup(4,3); - f1.seqcomp(s1.get_seq(), s2.get_seq(), false); - f1.seqcomp(s1.get_seq(), s2.rev_comp(), true); + f1.seqcomp(s1, s2, false); + f1.seqcomp(s1, s2.rev_comp(), true); FLPs f2; f2.setup(4,3); - f2.seqcomp(s1.get_seq(), s2.rev_comp(), true); - f2.seqcomp(s1.get_seq(), s2.get_seq(), false); + f2.seqcomp(s1, s2.rev_comp(), true); + f2.seqcomp(s1, s2, false); // The order of doing the reverse compliment search shouldn't matter // when we're using exactly the same sequence @@ -96,3 +108,10 @@ BOOST_AUTO_TEST_CASE( flp_reverse_compliment ) // FIXME: should we test the individual lists? } } + +BOOST_AUTO_TEST_CASE( flp_file_check ) +{ + fs::path filename = "Thy_micturations_are_to_me_as_plurdled_gabbleblotchits"; + FLPs f1; + BOOST_CHECK_THROW( f1.load(filename), mussa_load_error); +}