summaryrefslogtreecommitdiff
path: root/decoder/cfg_test.cc
diff options
context:
space:
mode:
authorgraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 04:08:59 +0000
committergraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 04:08:59 +0000
commit541915be79d90329f40381ef75c98c794ea0298c (patch)
tree197f5b99107d7487c39d5b46b8bc243c6a19cc2a /decoder/cfg_test.cc
parent695ee5c0b87365857925ecb53a45b97ba4582974 (diff)
cfg test
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@552 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg_test.cc')
-rwxr-xr-xdecoder/cfg_test.cc39
1 files changed, 39 insertions, 0 deletions
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 <gtest/gtest.h>
+#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();
+}