summaryrefslogtreecommitdiff
path: root/test_gason.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-16 21:25:52 +0100
committerPatrick Simianer <p@simianer.de>2014-08-16 21:25:52 +0100
commit9a0859212de4d1304f9392fe910921227421c8c3 (patch)
tree1b1276312c83415d7d7d3838ce0347441b71951a /test_gason.cc
parent3ba77e3474e39d7970784812f6851a726572f7c7 (diff)
cleanup
Diffstat (limited to 'test_gason.cc')
-rw-r--r--test_gason.cc71
1 files changed, 0 insertions, 71 deletions
diff --git a/test_gason.cc b/test_gason.cc
deleted file mode 100644
index d78c385..0000000
--- a/test_gason.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <string>
-#include <string.h>
-
-/*
- * https://github.com/vivkin/gason
- *
- */
-#include "gason/gason.h"
-
-using namespace std;
-
-
-void
-print(const char *s)
-{
- string u(s);
- u = u.substr(1, 4);
- if (u == "Goal") {
- cerr << u << endl;
- }
-}
-
-void
-walk(JsonValue o)
-{
- switch (o.getTag()) {
- case JSON_TAG_NUMBER:
- break;
- case JSON_TAG_BOOL:
- break;
- case JSON_TAG_STRING:
- print(o.toString());
- break;
- case JSON_TAG_ARRAY:
- if (!o.toNode())
- break;
- for (auto i : o)
- walk(i->value);
- break;
- case JSON_TAG_OBJECT:
- if (!o.toNode())
- break;
- for (auto i : o) {
- print(i->key);
- walk(i->value);
- }
- break;
- case JSON_TAG_NULL:
- break;
- }
-}
-
-int
-main(int argc, char** argv)
-{
- ifstream ifs(argv[1]);
- string json_str((istreambuf_iterator<char>(ifs)),
- (istreambuf_iterator<char>()));
-
- char* s = strdup(json_str.c_str());
- char *p;
- JsonValue v;
- JsonAllocator a;
- JsonParseStatus status = jsonParse(s, &p, &v, a);
- walk(v);
-
- return 0;
-}
-