| 468 | } |
| 469 | |
| 470 | void ImportTest::checkGeneralTestSectionSearch(json_spirit::mObject const& _expects, vector<size_t>& _errorTransactions, string const& _network, TrExpectSection* _search) const |
| 471 | { |
| 472 | vector<int> d; |
| 473 | vector<int> g; |
| 474 | vector<int> v; |
| 475 | vector<string> network; |
| 476 | if (_network.empty()) |
| 477 | parseJsonStrValueIntoVector(_expects.at("network"), network); |
| 478 | else |
| 479 | network.push_back(_network); |
| 480 | |
| 481 | BOOST_CHECK_MESSAGE(network.size() > 0, TestOutputHelper::testName() + "Network array not set!"); |
| 482 | vector<string> allowednetworks = {netIdToString(eth::Network::FrontierTest), netIdToString(eth::Network::HomesteadTest), |
| 483 | netIdToString(eth::Network::EIP150Test), netIdToString(eth::Network::EIP158Test), netIdToString(eth::Network::MetropolisTest), "ALL"}; |
| 484 | for(size_t i=0; i<network.size(); i++) |
| 485 | BOOST_CHECK_MESSAGE(inArray(allowednetworks, network.at(i)), TestOutputHelper::testName() + "Specified Network not found: " + network.at(i)); |
| 486 | |
| 487 | if (_expects.count("indexes")) |
| 488 | { |
| 489 | json_spirit::mObject const& indexes = _expects.at("indexes").get_obj(); |
| 490 | parseJsonIntValueIntoVector(indexes.at("data"), d); |
| 491 | parseJsonIntValueIntoVector(indexes.at("gas"), g); |
| 492 | parseJsonIntValueIntoVector(indexes.at("value"), v); |
| 493 | BOOST_CHECK_MESSAGE(d.size() > 0 && g.size() > 0 && v.size() > 0, TestOutputHelper::testName() + "Indexes arrays not set!"); |
| 494 | } |
| 495 | else |
| 496 | BOOST_ERROR(TestOutputHelper::testName() + "indexes section not set!"); |
| 497 | |
| 498 | bool foundResults = false; |
| 499 | std::vector<transactionToExecute> lookTransactions; |
| 500 | if (_search) |
| 501 | lookTransactions.push_back(_search->first); |
| 502 | else |
| 503 | lookTransactions = m_transactions; |
| 504 | for(size_t i = 0; i < lookTransactions.size(); i++) |
| 505 | { |
| 506 | transactionToExecute t = lookTransactions[i]; |
| 507 | if (inArray(network, netIdToString(t.netId)) || network[0] == "ALL") |
| 508 | if ((inArray(d, t.dataInd) || d[0] == -1) && (inArray(g, t.gasInd) || g[0] == -1) && (inArray(v, t.valInd) || v[0] == -1)) |
| 509 | { |
| 510 | string trInfo = netIdToString(t.netId) + " data: " + toString(t.dataInd) + " gas: " + toString(t.gasInd) + " val: " + toString(t.valInd); |
| 511 | if (_expects.count("result")) |
| 512 | { |
| 513 | Options const& opt = Options::get(); |
| 514 | //filter transactions if a specific index set in options |
| 515 | if ((opt.trDataIndex != -1 && opt.trDataIndex != t.dataInd) || |
| 516 | (opt.trGasIndex != -1 && opt.trGasIndex != t.gasInd) || |
| 517 | (opt.trValueIndex != -1 && opt.trValueIndex != t.valInd)) |
| 518 | continue; |
| 519 | |
| 520 | State postState = t.postState; |
| 521 | eth::AccountMaskMap stateMap; |
| 522 | State expectState(0, OverlayDB(), eth::BaseState::Empty); |
| 523 | importState(_expects.at("result").get_obj(), expectState, stateMap); |
| 524 | if (_search) |
| 525 | { |
| 526 | _search->second.first = expectState; |
| 527 | _search->second.second = stateMap; |
nothing calls this directly
no test coverage detected