summaryrefslogtreecommitdiff
path: root/decoder
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-05-11 20:31:57 -0400
committerKenneth Heafield <github@kheafield.com>2012-05-11 20:31:57 -0400
commit708ad7d7dbfc8f8d52312c3989f86b183e12af45 (patch)
tree50400d1eecea4c8bbb85b4a13ca28b5906604b08 /decoder
parente1cc454db3be1a5eedc3dba7022e813a772696d7 (diff)
Fix relative paths in tests.
Diffstat (limited to 'decoder')
-rw-r--r--decoder/Jamfile2
-rw-r--r--decoder/grammar_test.cc6
2 files changed, 5 insertions, 3 deletions
diff --git a/decoder/Jamfile b/decoder/Jamfile
index d7d42f28..f8112cae 100644
--- a/decoder/Jamfile
+++ b/decoder/Jamfile
@@ -65,7 +65,7 @@ lib cdec_lib :
exe cdec : cdec.cc cdec_lib ;
-all_tests [ glob *_test.cc : cfg_test.cc ] : cdec_lib ;
+all_tests [ glob *_test.cc : cfg_test.cc ] : cdec_lib : <testing.arg>$(TOP)/decoder/test_data ;
install legacy : cdec
: <location>$(TOP)/cdec <install-type>EXE <install-dependencies>on <link>shared:<dll-path>$(TOP)/cdec <link>shared:<install-type>LIB ;
diff --git a/decoder/grammar_test.cc b/decoder/grammar_test.cc
index e1a94709..4500490a 100644
--- a/decoder/grammar_test.cc
+++ b/decoder/grammar_test.cc
@@ -17,7 +17,8 @@ using namespace std;
struct GrammarTest {
GrammarTest() {
- Weights::InitFromFile("test_data/weights.gt", &wts);
+ std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data");
+ Weights::InitFromFile(path + "/weights.gt", &wts);
}
vector<weight_t> wts;
};
@@ -40,7 +41,8 @@ BOOST_AUTO_TEST_CASE(TestTextGrammar) {
}
BOOST_AUTO_TEST_CASE(TestTextGrammarFile) {
- GrammarPtr g(new TextGrammar("./test_data/grammar.prune"));
+ std::string path(boost::unit_test::framework::master_test_suite().argc == 2 ? boost::unit_test::framework::master_test_suite().argv[1] : "test_data");
+ GrammarPtr g(new TextGrammar(path + "/grammar.prune"));
vector<GrammarPtr> grammars(1, g);
LatticeArc a(TD::Convert("ein"), 0.0, 1);