Skip to content

Commit

Permalink
remove dependency on gtest, remove all-static
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dyer committed May 2, 2012
1 parent 3efa261 commit d59bad8
Show file tree
Hide file tree
Showing 22 changed files with 314 additions and 499 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ AC_PROG_CXX
AC_LANG_CPLUSPLUS
BOOST_REQUIRE([1.44])
BOOST_PROGRAM_OPTIONS
BOOST_TEST
AC_ARG_ENABLE(mpi,
[ --enable-mpi Build MPI binaries, assumes mpi.h is present ],
[ mpi=yes
Expand Down Expand Up @@ -77,7 +78,6 @@ AC_CHECK_HEADER(google/dense_hash_map,
[AC_DEFINE([HAVE_SPARSEHASH], [1], [flag for google::dense_hash_map])])

AC_PROG_INSTALL
GTEST_LIB_CHECK(1.0)

AM_CONDITIONAL([RAND_LM], false)
AC_ARG_WITH(randlm,
Expand Down
21 changes: 6 additions & 15 deletions decoder/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,34 +1,25 @@
bin_PROGRAMS = cdec

if HAVE_GTEST
noinst_PROGRAMS = \
trule_test \
hg_test \
ff_test \
parser_test \
grammar_test

# cfg_test
TESTS = trule_test ff_test parser_test grammar_test hg_test
# cfg_test
#cfg_test_SOURCES = cfg_test.cc
#cfg_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
TESTS = trule_test parser_test grammar_test hg_test
parser_test_SOURCES = parser_test.cc
parser_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
ff_test_SOURCES = ff_test.cc
ff_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
parser_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
grammar_test_SOURCES = grammar_test.cc
grammar_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
grammar_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
hg_test_SOURCES = hg_test.cc
hg_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
hg_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
trule_test_SOURCES = trule_test.cc
trule_test_LDADD = $(GTEST_LDFLAGS) $(GTEST_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz
endif
trule_test_LDADD = $(BOOST_UNIT_TEST_FRAMEWORK_LDFLAGS) $(BOOST_UNIT_TEST_FRAMEWORK_LIBS) libcdec.a ../mteval/libmteval.a ../utils/libutils.a -lz

cdec_SOURCES = cdec.cc
cdec_LDADD = libcdec.a ../mteval/libmteval.a ../utils/libutils.a ../klm/lm/libklm.a ../klm/util/libklm_util.a -lz

AM_CPPFLAGS = -W -Wno-sign-compare $(GTEST_CPPFLAGS) -I.. -I../mteval -I../utils -I../klm
AM_CPPFLAGS = -DBOOST_TEST_DYN_LINK -W -Wno-sign-compare $(GTEST_CPPFLAGS) -I.. -I../mteval -I../utils -I../klm

rule_lexer.cc: rule_lexer.l
$(LEX) -s -CF -8 -o$@ $<
Expand Down
1 change: 1 addition & 0 deletions decoder/earley_composer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <fstream>
#include <map>
#include <queue>
#include <tr1/unordered_map>
#include <tr1/unordered_set>

#include <boost/shared_ptr.hpp>
Expand Down
64 changes: 0 additions & 64 deletions decoder/ff_test.cc

This file was deleted.

1 change: 1 addition & 0 deletions decoder/grammar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <utility>
#include <map>
#include <tr1/unordered_map>
#include <tr1/unordered_set>

#include "rule_lexer.h"
#include "filelib.h"
Expand Down
24 changes: 11 additions & 13 deletions decoder/grammar_test.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#define BOOST_TEST_MODULE g_test
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>

#include <cassert>
#include <iostream>
#include <fstream>
#include <vector>
#include <gtest/gtest.h>
#include "trule.h"
#include "tdict.h"
#include "grammar.h"
Expand All @@ -12,18 +15,16 @@

using namespace std;

class GrammarTest : public testing::Test {
public:
struct GrammarTest {
GrammarTest() {
Weights::InitFromFile("test_data/weights.gt", &wts);
}
protected:
virtual void SetUp() { }
virtual void TearDown() { }
vector<weight_t> wts;
};

TEST_F(GrammarTest,TestTextGrammar) {

BOOST_FIXTURE_TEST_SUITE( s, GrammarTest );

BOOST_AUTO_TEST_CASE(TestTextGrammar) {
vector<double> w;
vector<const FeatureFunction*> ms;
ModelSet models(w, ms);
Expand All @@ -38,7 +39,7 @@ TEST_F(GrammarTest,TestTextGrammar) {
g.AddRule(r3);
}

TEST_F(GrammarTest,TestTextGrammarFile) {
BOOST_AUTO_TEST_CASE(TestTextGrammarFile) {
GrammarPtr g(new TextGrammar("./test_data/grammar.prune"));
vector<GrammarPtr> grammars(1, g);

Expand All @@ -52,8 +53,5 @@ TEST_F(GrammarTest,TestTextGrammarFile) {
parser.Parse(lattice, &forest);
forest.PrintGraphviz();
}
BOOST_AUTO_TEST_SUITE_END()

int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Loading

0 comments on commit d59bad8

Please sign in to comment.