Add namecoin.json and fix in TestRunner

This commit is contained in:
nicksavers 2014-07-13 23:05:04 +02:00
parent 48691c745a
commit bc24645644
4 changed files with 24 additions and 5 deletions

View File

@ -6,7 +6,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.ethereum.crypto.SHA3Helper;
import org.ethereum.trie.Trie;
import org.ethereum.util.RLP;
import org.ethereum.util.RLPElement;

View File

@ -2,7 +2,6 @@ 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;

View File

@ -65,7 +65,7 @@ public class TestRunner {
Env env = testCase.getEnv();
Exec exec = testCase.getExec();
byte[] address = exec.getAddress();
byte[] address = exec.getAddress(); //repository.createAccount(address);
byte[] origin = exec.getOrigin();
byte[] caller = exec.getCaller();
byte[] balance = ByteUtil.bigIntegerToBytes(repository.getBalance(exec.getAddress()));
@ -158,7 +158,7 @@ public class TestRunner {
byte[] expectedStValue = storage.get(storageKey).getData();
ContractDetails contractDetails =
program.getResult().getRepository().getContractDetails(storageKey.getData());
program.getResult().getRepository().getContractDetails(accountState.getAddress());
if (contractDetails == null){

View File

@ -314,8 +314,29 @@ public class JSONTestSuiteTest {
List<String> result = runner.runTestCase(testCase);
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());
}
}
}