aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Wasinger <j-wasinger@hotmail.com>2017-07-04 16:15:33 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit04350351733b1441a2b11502e674b16dd6c47659 (patch)
treed61e64a9bade807c98069bdc1e137443177929f4
parent2209036fb9ddf776b67b29e337e77175caf407bd (diff)
downloaddexon-tests-04350351733b1441a2b11502e674b16dd6c47659.tar.gz
dexon-tests-04350351733b1441a2b11502e674b16dd6c47659.tar.zst
dexon-tests-04350351733b1441a2b11502e674b16dd6c47659.zip
modify validation script to run against all test cases under GeneralStateTests
-rwxr-xr-xGeneralStateTests/schema/run.sh2
-rwxr-xr-xGeneralStateTests/schema/validate.js34
2 files changed, 9 insertions, 27 deletions
diff --git a/GeneralStateTests/schema/run.sh b/GeneralStateTests/schema/run.sh
index a2a0f2db8..45cfbf363 100755
--- a/GeneralStateTests/schema/run.sh
+++ b/GeneralStateTests/schema/run.sh
@@ -1 +1 @@
-echo -e "$(find .. -name '*.json')" | node validate.js
+echo -e "$(find .. -name '*.json' ! -path '../schema/*.json')" | node validate.js
diff --git a/GeneralStateTests/schema/validate.js b/GeneralStateTests/schema/validate.js
index 6f2feef9b..af3e3b495 100755
--- a/GeneralStateTests/schema/validate.js
+++ b/GeneralStateTests/schema/validate.js
@@ -15,15 +15,13 @@ var rl = readline.createInterface({
});
rl.on('line', function(line){
- fs.readFile('simple-schema.json', function(err, data) {
+ fs.readFile('schema.json', function(err, data) {
if (err) {
throw err;
}
-
schema = JSON.parse(data);
-
fs.readFile(line, function(err, data) {
if (err) {
throw err;
@@ -32,35 +30,19 @@ rl.on('line', function(line){
try {
testCode = JSON.parse(data);
} catch(e) {
- debugger;
+ console.log(e);
}
try {
var x = validate(testCode, schema);
+
+ if (x.errors.length > 0) {
+ console.log(line+':\n');
+ console.log(x.errors+'\n')
+ }
} catch(e) {
- console.log(line);
+ console.log(e);
}
-
});
});
});
-
-/*
-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;
- });
-});
-*/