public IEnumerable <EthereumTestResult> RunTests() { List <EthereumTestResult> results = new List <EthereumTestResult>(); IEnumerable <BlockchainTest> tests = _testsSource.LoadTests(); foreach (BlockchainTest test in tests) { EthereumTestResult result = null; if (!_alwaysTrace) { result = RunTest(test, NullTxTracer.Instance); } if (!(result?.Pass ?? false)) { StateTestTxTracer txTracer = new StateTestTxTracer(); result = RunTest(test, txTracer); var txTrace = txTracer.BuildResult(); txTrace.Result.Time = result.TimeInMs; txTrace.State.StateRoot = result.StateRoot; WriteErr(txTrace); } results.Add(result); } WriteOut(results); return(results); }
public IEnumerable <EthereumTestResult> RunTests() { List <EthereumTestResult> results = new List <EthereumTestResult>(); IEnumerable <BlockchainTest> tests = _testsSource.LoadTests(); foreach (BlockchainTest test in tests) { EthereumTestResult result = null; if (_whenTrace != WhenTrace.Always) { result = RunTest(test, NullTxTracer.Instance); } if (_whenTrace != WhenTrace.Never && !(result?.Pass ?? false)) { StateTestTxTracer txTracer = new StateTestTxTracer(); txTracer.IsTracingMemory = _traceMemory; txTracer.IsTracingStack = _traceStack; result = RunTest(test, txTracer); var txTrace = txTracer.BuildResult(); txTrace.Result.Time = result.TimeInMs; txTrace.State.StateRoot = result.StateRoot; txTrace.Result.GasUsed -= _calculator.Calculate(test.Transaction, test.Fork); WriteErr(txTrace); } results.Add(result); } WriteOut(results); Console.ReadLine(); return(results); }