summaryrefslogtreecommitdiff
path: root/klm/lm/model_test.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-02-21 14:13:55 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-02-21 14:13:55 +0000
commitb5491898549c61bd799d199aa9178a8394a1ef69 (patch)
treefb2686a2aae03ff07bcdf4cd47e8c3191eff8d1e /klm/lm/model_test.cc
parent0187447a643c3ea262b13b3052cb1531990eafe6 (diff)
parentc17d9c23d023a5c08656376944f636180f0a437b (diff)
Merge branch 'master' of https://github.com/pauldb89/cdec
Diffstat (limited to 'klm/lm/model_test.cc')
-rw-r--r--klm/lm/model_test.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/klm/lm/model_test.cc b/klm/lm/model_test.cc
index 32084b5b..eb159094 100644
--- a/klm/lm/model_test.cc
+++ b/klm/lm/model_test.cc
@@ -1,6 +1,7 @@
#include "lm/model.hh"
#include <stdlib.h>
+#include <string.h>
#define BOOST_TEST_MODULE ModelTest
#include <boost/test/unit_test.hpp>
@@ -22,17 +23,20 @@ std::ostream &operator<<(std::ostream &o, const State &state) {
namespace {
+// Stupid bjam reverses the command line arguments randomly.
const char *TestLocation() {
- if (boost::unit_test::framework::master_test_suite().argc < 2) {
+ if (boost::unit_test::framework::master_test_suite().argc < 3) {
return "test.arpa";
}
- return boost::unit_test::framework::master_test_suite().argv[1];
+ char **argv = boost::unit_test::framework::master_test_suite().argv;
+ return argv[strstr(argv[1], "nounk") ? 2 : 1];
}
const char *TestNoUnkLocation() {
if (boost::unit_test::framework::master_test_suite().argc < 3) {
return "test_nounk.arpa";
}
- return boost::unit_test::framework::master_test_suite().argv[2];
+ char **argv = boost::unit_test::framework::master_test_suite().argv;
+ return argv[strstr(argv[1], "nounk") ? 1 : 2];
}
template <class Model> State GetState(const Model &model, const char *word, const State &in) {