Add namecoin.json and fix in TestRunner
This commit is contained in:
parent
48691c745a
commit
bc24645644
|
@ -6,7 +6,6 @@ import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.ethereum.crypto.SHA3Helper;
|
|
||||||
import org.ethereum.trie.Trie;
|
import org.ethereum.trie.Trie;
|
||||||
import org.ethereum.util.RLP;
|
import org.ethereum.util.RLP;
|
||||||
import org.ethereum.util.RLPElement;
|
import org.ethereum.util.RLPElement;
|
||||||
|
|
|
@ -2,7 +2,6 @@ package org.ethereum.jsontestsuite;
|
||||||
|
|
||||||
import org.ethereum.db.ByteArrayWrapper;
|
import org.ethereum.db.ByteArrayWrapper;
|
||||||
import org.ethereum.util.ByteUtil;
|
import org.ethereum.util.ByteUtil;
|
||||||
import org.json.simple.JSONArray;
|
|
||||||
import org.json.simple.JSONObject;
|
import org.json.simple.JSONObject;
|
||||||
import org.spongycastle.util.encoders.Hex;
|
import org.spongycastle.util.encoders.Hex;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class TestRunner {
|
||||||
Env env = testCase.getEnv();
|
Env env = testCase.getEnv();
|
||||||
Exec exec = testCase.getExec();
|
Exec exec = testCase.getExec();
|
||||||
|
|
||||||
byte[] address = exec.getAddress();
|
byte[] address = exec.getAddress(); //repository.createAccount(address);
|
||||||
byte[] origin = exec.getOrigin();
|
byte[] origin = exec.getOrigin();
|
||||||
byte[] caller = exec.getCaller();
|
byte[] caller = exec.getCaller();
|
||||||
byte[] balance = ByteUtil.bigIntegerToBytes(repository.getBalance(exec.getAddress()));
|
byte[] balance = ByteUtil.bigIntegerToBytes(repository.getBalance(exec.getAddress()));
|
||||||
|
@ -158,7 +158,7 @@ public class TestRunner {
|
||||||
byte[] expectedStValue = storage.get(storageKey).getData();
|
byte[] expectedStValue = storage.get(storageKey).getData();
|
||||||
|
|
||||||
ContractDetails contractDetails =
|
ContractDetails contractDetails =
|
||||||
program.getResult().getRepository().getContractDetails(storageKey.getData());
|
program.getResult().getRepository().getContractDetails(accountState.getAddress());
|
||||||
|
|
||||||
if (contractDetails == null){
|
if (contractDetails == null){
|
||||||
|
|
||||||
|
|
|
@ -314,8 +314,29 @@ public class JSONTestSuiteTest {
|
||||||
List<String> result = runner.runTestCase(testCase);
|
List<String> result = runner.runTestCase(testCase);
|
||||||
Assert.assertTrue(result.isEmpty());
|
Assert.assertTrue(result.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test // testing full suite
|
||||||
|
public void testNameCoinFromGitHub() throws ParseException {
|
||||||
|
|
||||||
|
String json = Utils.getFromUrl("https://raw.githubusercontent.com/ethereum/tests/develop/namecoin.json");
|
||||||
|
Assume.assumeFalse("Online test suite is no available", json.equals(""));
|
||||||
|
|
||||||
|
JSONParser parser = new JSONParser();
|
||||||
|
JSONObject testSuiteObj = (JSONObject)parser.parse(json);
|
||||||
|
|
||||||
|
TestSuite testSuite = new TestSuite(testSuiteObj);
|
||||||
|
Iterator<TestCase> testIterator = testSuite.iterator();
|
||||||
|
|
||||||
|
while (testIterator.hasNext()){
|
||||||
|
|
||||||
|
TestCase testCase = testIterator.next();
|
||||||
|
|
||||||
|
System.out.println("Running: " + testCase.getName());
|
||||||
|
TestRunner runner = new TestRunner();
|
||||||
|
List<String> result = runner.runTestCase(testCase);
|
||||||
|
Assert.assertTrue(result.isEmpty());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue