From b6806c7f27bb0b901aca5c920daf6321e39c7dcd Mon Sep 17 00:00:00 2001 From: "graehl@gmail.com" Date: Sun, 15 Aug 2010 04:08:59 +0000 Subject: cfg test git-svn-id: https://ws10smt.googlecode.com/svn/trunk@552 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/cfg_test.cc | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 decoder/cfg_test.cc (limited to 'decoder/cfg_test.cc') diff --git a/decoder/cfg_test.cc b/decoder/cfg_test.cc new file mode 100755 index 00000000..c4c37a2c --- /dev/null +++ b/decoder/cfg_test.cc @@ -0,0 +1,39 @@ +#include +#include "cfg.h" +#include "hg_test.h" +#include "cfg_options.h" + +struct CFGTest : public HGSetup { + CFGTest() { } + ~CFGTest() { } + static void JsonFN(Hypergraph hg,CFG &cfg,std::string file + ,std::string const& wts="Model_0 1 EgivenF 1 f1 1") + { + FeatureVector v; + istringstream ws(wts); +// ASSERT_TRUE(ws>>v); + HGSetup::JsonTestFile(&hg,file); +// hg.Reweight(v); + cfg.Init(hg,true,false,false); + } + + static void SetUpTestCase() { + } + static void TearDownTestCase() { + } +}; + +TEST_F(CFGTest,Binarize) { + Hypergraph hg; + CFG cfg; + JsonFN(hg,cfg,perro_json,perro_wts); + CFGFormat form; + form.features=true; + cerr<<"\nCFG Test.\n\n"; + cfg.Print(cerr,form); +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} -- cgit v1.2.3