Package test.ethereum.jsontestsuite

Source Code of test.ethereum.jsontestsuite.GitHubJSONTestSuite

package test.ethereum.jsontestsuite;

import java.util.Iterator;
import java.util.List;

import org.ethereum.jsontestsuite.TestCase;
import org.ethereum.jsontestsuite.TestRunner;
import org.ethereum.jsontestsuite.TestSuite;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

/**
* Test file specific for tests maintained in the GitHub repository
* by the Ethereum DEV team. <br/>
*
* @see <a href="https://github.com/ethereum/tests/">https://github.com/ethereum/tests/</a>
*/
@RunWith(Suite.class)
@SuiteClasses({
  GitHubVMTest.class,
  GitHubRandomTest.class
})
public class GitHubJSONTestSuite {
   
    protected static void runGitHubJsonTest(String json) throws ParseException {
        Assume.assumeFalse("Online test is not 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();
           
            TestRunner runner = new TestRunner();
            List<String> result = runner.runTestCase(testCase);
            Assert.assertTrue(result.isEmpty());
        }
    }
}
TOP

Related Classes of test.ethereum.jsontestsuite.GitHubJSONTestSuite

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.