summaryrefslogtreecommitdiff
path: root/decoder/cfg_test.cc
diff options
context:
space:
mode:
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();
+}