aboutsummaryrefslogtreecommitdiffstats
path: root/JSONSchema
diff options
context:
space:
mode:
authorJared Wasinger <j-wasinger@hotmail.com>2017-07-06 04:33:09 +0800
committerUbuntu <ubuntu@ip-172-31-32-43.us-west-2.compute.internal>2017-08-08 04:41:46 +0800
commit291c054b2731de7172579ca629d1499be44f15fa (patch)
tree53667008e971dae06abf186ec0e2046c33e04b60 /JSONSchema
parent6117849a700de4d1fcb7245b2cfffbd3382c6cf8 (diff)
downloaddexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.gz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.bz2
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.lz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.xz
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.tar.zst
dexon-tests-291c054b2731de7172579ca629d1499be44f15fa.zip
format code. Remove unused python code
Diffstat (limited to 'JSONSchema')
-rw-r--r--JSONSchema/schema.json187
-rwxr-xr-xJSONSchema/validate.js20
-rwxr-xr-xJSONSchema/validate.py30
3 files changed, 105 insertions, 132 deletions
diff --git a/JSONSchema/schema.json b/JSONSchema/schema.json
index 6e7113950..74e796a88 100644
--- a/JSONSchema/schema.json
+++ b/JSONSchema/schema.json
@@ -1,131 +1,130 @@
{
- "type": "object",
- "patternProperties": {
- "^.*$": {
- "type": "object",
- "properties": {
- "post": {
- "type": "object",
- "properties": {
- "EIP150": {
- "type": "array"
+ "type":"object",
+ "patternProperties":{
+ "^.*$":{
+ "type":"object",
+ "properties":{
+ "post":{
+ "type":"object",
+ "properties":{
+ "EIP150":{
+ "type":"array"
},
- "EIP158": {
- "type": "array"
+ "EIP158":{
+ "type":"array"
},
- "Frontier": {
- "type": "array"
+ "Frontier":{
+ "type":"array"
},
- "Homestead": {
- "type": "array"
+ "Homestead":{
+ "type":"array"
},
- "Metropolis": {
- "type": "array"
+ "Metropolis":{
+ "type":"array"
}
- }
- },
- "explanation": {
- "type": "string"
+ }
},
- "env": {
- "type": "object",
- "properties": {
- "currentCoinbase": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "explanation":{
+ "type":"string"
+ },
+ "env":{
+ "type":"object",
+ "properties":{
+ "currentCoinbase":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "currentDifficulty": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "currentDifficulty":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "currentGasLimit": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "currentGasLimit":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "currentNumber": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "currentNumber":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "currentTimestamp": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "currentTimestamp":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "previousHash": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "previousHash":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
}
},
- "additionalproperties": false
+ "additionalproperties":false
},
- "pre": {
- "type": "object",
- "patternProperties": {
- "^0x[0-9a-f]*": {
- "type": "object",
- "properties": {
- "balance": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "pre":{
+ "type":"object",
+ "patternProperties":{
+ "^0x[0-9a-f]*":{
+ "type":"object",
+ "properties":{
+ "balance":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "code": {
- "type": "string",
- "pattern": "^(0x[0-9a-f]*)?$"
+ "code":{
+ "type":"string",
+ "pattern":"^(0x[0-9a-f]*)?$"
},
- "nonce": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
-
+ "nonce":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "storage": {
- "type": "object"
+ "storage":{
+ "type":"object"
}
}
}
},
- "additionalProperties": false
+ "additionalProperties":false
},
- "transaction": {
- "type": "object",
- "properties": {
- "data": {
- "type": "array",
- "items": {
- "type": "string",
- "pattern": "^(0x[0-9a-f]*)?$"
+ "transaction":{
+ "type":"object",
+ "properties":{
+ "data":{
+ "type":"array",
+ "items":{
+ "type":"string",
+ "pattern":"^(0x[0-9a-f]*)?$"
}
},
- "gasLimit": {
- "type": "array",
- "items": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "gasLimit":{
+ "type":"array",
+ "items":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
}
},
- "gasPrice": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "gasPrice":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "nonce": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "nonce":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "secretKey": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "secretKey":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "to": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "to":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
},
- "value": {
- "type": "array",
- "items": {
- "type": "string",
- "pattern": "^0x[0-9a-f]*$"
+ "value":{
+ "type":"array",
+ "items":{
+ "type":"string",
+ "pattern":"^0x[0-9a-f]*$"
}
}
},
- "additionalProperties": false
+ "additionalProperties":false
}
}
}
diff --git a/JSONSchema/validate.js b/JSONSchema/validate.js
index 6c44b834f..e3037ccad 100755
--- a/JSONSchema/validate.js
+++ b/JSONSchema/validate.js
@@ -4,17 +4,20 @@ var validate = require('jsonschema').validate;
var fs = require('fs');
var readline = require('readline');
+var process = require('process');
+
var schema = '';
var testCode = '';
+var success = true;
var readline = require('readline');
var rl = readline.createInterface({
- input: process.stdin,
- output: process.stdout,
- terminal: false
+ input: process.stdin,
+ output: process.stdout,
+ terminal: false
});
-rl.on('line', function(line){
+rl.on('line', function(line) {
fs.readFile('JSONSchema/schema.json', function(err, data) {
if (err) {
throw err;
@@ -29,7 +32,7 @@ rl.on('line', function(line){
try {
testCode = JSON.parse(data);
- } catch(e) {
+ } catch (e) {
console.log(e);
}
@@ -37,12 +40,13 @@ rl.on('line', function(line){
var x = validate(testCode, schema);
if (x.errors.length > 0) {
- console.log(line+':\n');
+ success = false;
+ console.log(line + ':\n');
for (var i = 0; i < x.errors.length; i++) {
- console.log(' '+x.errors[i]+'\n')
+ console.log(' ' + x.errors[i] + '\n')
}
}
- } catch(e) {
+ } catch (e) {
console.log(e);
}
});
diff --git a/JSONSchema/validate.py b/JSONSchema/validate.py
deleted file mode 100755
index 086abfa93..000000000
--- a/JSONSchema/validate.py
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/env python
-
-import glob, json, sys, jsonschema
-
-with open('JSONSchema/schema.json') as schema_data:
- schema = json.load(schema_data)
-
-#for filename in glob.glob('GeneralStateTests/*.json'):
-# print(filename)
-
-while True:
- line = sys.stdin.readline()
- if not line:
- if success:
- sys.exit(0)
- else:
- sys.exit(-1)
-
- line = line.strip('\n')
- with open(line) as test_data:
- test = json.load(test_data)
-
- try:
- jsonschema.validate(test, schema)
- except jsonschema.exceptions.ValidationError as e:
- success = False
- print(line+':\n\n')
- print(e)
- print('\n')
-