From 1c32f3e2831aefdf50fd226d3e1b314c804afc3b Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Wed, 2 May 2012 02:30:52 -0400 Subject: remove dependency on gtest, remove all-static --- decoder/ff_test.cc | 64 ------------------------------------------------------ 1 file changed, 64 deletions(-) delete mode 100644 decoder/ff_test.cc (limited to 'decoder/ff_test.cc') diff --git a/decoder/ff_test.cc b/decoder/ff_test.cc deleted file mode 100644 index 9e640517..00000000 --- a/decoder/ff_test.cc +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include -#include "hg.h" -#include "ff_lm.h" -#include "ff.h" -#include "trule.h" -#include "sentence_metadata.h" - -using namespace std; - -LanguageModel* lm_ = NULL; -LanguageModel* lm3_ = NULL; - -class FFTest : public testing::Test { - public: - FFTest() : smeta(0,Lattice()) { - if (!lm_) { - static LanguageModel slm("-o 2 ./test_data/test_2gram.lm.gz"); - lm_ = &slm; - static LanguageModel slm3("./test_data/dummy.3gram.lm -o 3"); - lm3_ = &slm3; - } - } - protected: - virtual void SetUp() { } - virtual void TearDown() { } - SentenceMetadata smeta; -}; - -TEST_F(FFTest, LM3) { - int x = lm3_->NumBytesContext(); - Hypergraph::Edge edge1; - edge1.rule_.reset(new TRule("[X] ||| x y ||| one ||| 1.0 -2.4 3.0")); - Hypergraph::Edge edge2; - edge2.rule_.reset(new TRule("[X] ||| [X,1] a ||| [X,1] two ||| 1.0 -2.4 3.0")); - Hypergraph::Edge edge3; - edge3.rule_.reset(new TRule("[X] ||| [X,1] a ||| zero [X,1] two ||| 1.0 -2.4 3.0")); - vector ants1; - string state(x, '\0'); - SparseVector feats; - SparseVector est; - lm3_->TraversalFeatures(smeta, edge1, ants1, &feats, &est, (void *)&state[0]); - cerr << "returned " << feats << endl; - cerr << edge1.feature_values_ << endl; - cerr << lm3_->DebugStateToString((const void*)&state[0]) << endl; - EXPECT_EQ("[ one ]", lm3_->DebugStateToString((const void*)&state[0])); - ants1.push_back((const void*)&state[0]); - string state2(x, '\0'); - lm3_->TraversalFeatures(smeta, edge2, ants1, &feats, &est, (void *)&state2[0]); - cerr << lm3_->DebugStateToString((const void*)&state2[0]) << endl; - EXPECT_EQ("[ one two ]", lm3_->DebugStateToString((const void*)&state2[0])); - string state3(x, '\0'); - lm3_->TraversalFeatures(smeta, edge3, ants1, &feats, &est, (void *)&state3[0]); - cerr << lm3_->DebugStateToString((const void*)&state3[0]) << endl; - EXPECT_EQ("[ zero one <{STAR}> one two ]", lm3_->DebugStateToString((const void*)&state3[0])); -} - -int main(int argc, char **argv) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} -- cgit v1.2.3