Fix JSONTestSuite for updated vmtests.json
This commit is contained in:
parent
b0a564e51e
commit
73db273715
|
@ -1,16 +1,10 @@
|
|||
package org.ethereum.jsontestsuite;
|
||||
|
||||
import org.ethereum.db.ByteArrayWrapper;
|
||||
import org.ethereum.util.ByteUtil;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.spongycastle.util.encoders.Hex;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* www.ethereumJ.com
|
||||
|
@ -36,10 +30,10 @@ public class CallCreate {
|
|||
|
||||
public CallCreate(JSONObject callCreateJSON) {
|
||||
|
||||
String data = (String)callCreateJSON.get("data");
|
||||
String destination = (String)callCreateJSON.get("destination");
|
||||
Long gasLimit = (Long)callCreateJSON.get("gasLimit");
|
||||
Long value = (Long)callCreateJSON.get("value");
|
||||
String data = callCreateJSON.get("data").toString();
|
||||
String destination = callCreateJSON.get("destination").toString();
|
||||
String gasLimit = callCreateJSON.get("gasLimit").toString();
|
||||
String value = callCreateJSON.get("value").toString();
|
||||
|
||||
if (data != null && data.length() > 2)
|
||||
this.data = Hex.decode(data.substring(2));
|
||||
|
@ -48,8 +42,8 @@ public class CallCreate {
|
|||
|
||||
|
||||
this.destination = Hex.decode(destination);
|
||||
this.gasLimit = ByteUtil.bigIntegerToBytes( BigInteger.valueOf(gasLimit) );
|
||||
this.value = ByteUtil.bigIntegerToBytes( BigInteger.valueOf(value) );
|
||||
this.gasLimit = ByteUtil.bigIntegerToBytes(new BigInteger(gasLimit));
|
||||
this.value = ByteUtil.bigIntegerToBytes(new BigInteger(value));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,8 +69,8 @@ public class Exec {
|
|||
else
|
||||
this.data = new byte[0];
|
||||
|
||||
this.gas = ByteUtil.bigIntegerToBytes( new BigInteger(gas) );
|
||||
this.gasPrice = ByteUtil.bigIntegerToBytes( new BigInteger(gasPrice) );
|
||||
this.gas = ByteUtil.bigIntegerToBytes(new BigInteger(gas));
|
||||
this.gasPrice = ByteUtil.bigIntegerToBytes(new BigInteger(gasPrice));
|
||||
|
||||
this.origin = Hex.decode(origin);
|
||||
this.value = ByteUtil.bigIntegerToBytes(new BigInteger(value));
|
||||
|
|
|
@ -48,7 +48,6 @@ public class TestCase {
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
public TestCase(JSONObject testCaseJSONObj) throws ParseException{
|
||||
|
||||
try {
|
||||
|
@ -59,10 +58,14 @@ public class TestCase {
|
|||
JSONObject postJSON = (JSONObject)testCaseJSONObj.get("post");
|
||||
JSONArray callCreates = (JSONArray)testCaseJSONObj.get("callcreates");
|
||||
|
||||
Long gasNum = (Long)testCaseJSONObj.get("gas");
|
||||
this.gas = ByteUtil.bigIntegerToBytes(BigInteger.valueOf(gasNum));
|
||||
|
||||
this.out = Helper.parseDataArray((JSONArray) testCaseJSONObj.get("out"));
|
||||
String gasString = testCaseJSONObj.get("gas").toString();
|
||||
this.gas = ByteUtil.bigIntegerToBytes(new BigInteger(gasString));
|
||||
|
||||
String outString = testCaseJSONObj.get("out").toString();
|
||||
if (outString != null && outString.length() > 2)
|
||||
this.out = Hex.decode(outString.substring(2));
|
||||
else
|
||||
this.out = new byte[0];
|
||||
|
||||
for (Object key : preJSON.keySet()){
|
||||
|
||||
|
|
Loading…
Reference in New Issue