diff options
-rw-r--r-- | decoder/cfg_test.cc | 3 | ||||
-rw-r--r-- | decoder/hg_test.cc | 3 | ||||
-rw-r--r-- | decoder/hg_test.h | 6 | ||||
-rw-r--r-- | jam-files/sanity.jam | 6 |
4 files changed, 12 insertions, 6 deletions
diff --git a/decoder/cfg_test.cc b/decoder/cfg_test.cc index c61f9f2c..b8f4cf11 100644 --- a/decoder/cfg_test.cc +++ b/decoder/cfg_test.cc @@ -33,7 +33,8 @@ struct CFGTest : public TestWithParam<HgW> { istringstream ws(wts); EXPECT_TRUE(ws>>featw); CSHOW(featw) - HGSetup::JsonTestFile(&hg,file); + std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data"); + HGSetup::JsonTestFile(&hg,path,file); hg.Reweight(featw); cfg.Init(hg,true,true,false); } diff --git a/decoder/hg_test.cc b/decoder/hg_test.cc index 8455a865..92ed98b2 100644 --- a/decoder/hg_test.cc +++ b/decoder/hg_test.cc @@ -335,7 +335,8 @@ BOOST_AUTO_TEST_CASE(TestAddExpectations) { BOOST_AUTO_TEST_CASE(Small) { Hypergraph hg; - CreateSmallHG(&hg); + std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data"); + CreateSmallHG(&hg, path); SparseVector<double> wts; wts.set_value(FD::Convert("Model_0"), -2.0); wts.set_value(FD::Convert("Model_1"), -0.5); diff --git a/decoder/hg_test.h b/decoder/hg_test.h index 043f970a..2e308c37 100644 --- a/decoder/hg_test.h +++ b/decoder/hg_test.h @@ -46,10 +46,10 @@ struct HGSetup { ReadFile rf(f); HypergraphIO::ReadFromJSON(rf.stream(), hg); } - static void JsonTestFile(Hypergraph *hg,std::string n) { - JsonFile(hg,"test_data/"+n); + static void JsonTestFile(Hypergraph *hg,std::string path,std::string n) { + JsonFile(hg,path + "/"+n); } - static void CreateSmallHG(Hypergraph *hg) { JsonTestFile(hg,small_json); } + static void CreateSmallHG(Hypergraph *hg, std::string path) { JsonTestFile(hg,path,small_json); } }; namespace { diff --git a/jam-files/sanity.jam b/jam-files/sanity.jam index a89e95f9..eeb59f6e 100644 --- a/jam-files/sanity.jam +++ b/jam-files/sanity.jam @@ -21,7 +21,11 @@ rule test_flags ( flags * ) { echo $(cmd) ; echo $(ret) ; } - return $(ret[2]) == 0 ; + if $(ret[2]) = 0 { + return true ; + } else { + return ; + } } rule test_header ( name ) { |