From 9a0859212de4d1304f9392fe910921227421c8c3 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 16 Aug 2014 21:25:52 +0100 Subject: cleanup --- src/test_nosjob.cc | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/test_nosjob.cc (limited to 'src/test_nosjob.cc') diff --git a/src/test_nosjob.cc b/src/test_nosjob.cc new file mode 100644 index 0000000..cf8891f --- /dev/null +++ b/src/test_nosjob.cc @@ -0,0 +1,32 @@ +#include +#include +#include + +/* + * http://fossil.wanderinghorse.net/repos/nosjob/index.cgi/index + * + */ +#include "nosjob-e1d67401fcda6e05/include/wh/nosjob/nosjob.hpp" + +using namespace std; + + +int +main(int argc, char** argv) +{ + ifstream ifs(argv[1]); + string json_str((istreambuf_iterator(ifs)), + (istreambuf_iterator())); + + nosjob::Atom root = nosjob::JsonParser().parse(json_str); + nosjob::Object o = nosjob::Object::cast(root); + nosjob::Atom edges = o.get(nosjob::Utf8String("edges")); + nosjob::Array a = nosjob::Array::cast(edges); + nosjob::Object last_edge = nosjob::Object::cast(a.get(a.size()-1)); + nosjob::Utf8String s = nosjob::Utf8String::cast(last_edge.get(nosjob::Utf8String("rule"))); + string t((char*)s.c_str()); + cerr << t.substr(1, 4) << endl; + + return 0; +} + -- cgit v1.2.3