aboutsummaryrefslogtreecommitdiffstats
path: root/GeneralStateTests/schema/validate.js
diff options
context:
space:
mode:
authorJared Wasinger <j-wasinger@hotmail.com>2017-07-04 15:34:57 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit2209036fb9ddf776b67b29e337e77175caf407bd (patch)
tree86eb36283b8f2685962f21b5de3c1c81c535e2af /GeneralStateTests/schema/validate.js
parente0c62ccd02a72032c412882e85a0db72fa496946 (diff)
downloaddexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar.gz
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar.bz2
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar.lz
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar.xz
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.tar.zst
dexon-tests-2209036fb9ddf776b67b29e337e77175caf407bd.zip
add working schema outline
Diffstat (limited to 'GeneralStateTests/schema/validate.js')
-rwxr-xr-xGeneralStateTests/schema/validate.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/GeneralStateTests/schema/validate.js b/GeneralStateTests/schema/validate.js
new file mode 100755
index 000000000..6f2feef9b
--- /dev/null
+++ b/GeneralStateTests/schema/validate.js
@@ -0,0 +1,66 @@
+#! /bin/env node
+
+var validate = require('jsonschema').validate;
+var fs = require('fs');
+
+var readline = require('readline');
+var schema = '';
+var testCode = '';
+
+var readline = require('readline');
+var rl = readline.createInterface({
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false
+});
+
+rl.on('line', function(line){
+ fs.readFile('simple-schema.json', function(err, data) {
+ if (err) {
+ throw err;
+ }
+
+
+ schema = JSON.parse(data);
+
+
+ fs.readFile(line, function(err, data) {
+ if (err) {
+ throw err;
+ }
+
+ try {
+ testCode = JSON.parse(data);
+ } catch(e) {
+ debugger;
+ }
+
+ try {
+ var x = validate(testCode, schema);
+ } catch(e) {
+ console.log(line);
+ }
+
+ });
+ });
+});
+
+/*
+fs.readFile('simple-schema.json', function(err, data) {
+ if (err) {
+ throw err;
+ }
+
+ schema = JSON.parse(data);
+ fs.readFile('example.json', function(err, data) {
+ if (err) {
+ throw err;
+ }
+
+ testCode = JSON.parse(data);
+ var x = validate(testCode, schema);
+ console.log(x);
+ debugger;
+ });
+});
+*/