Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10800 from EOSIO/huangminghuang/EPE-1255-fix-kv-test
Browse files Browse the repository at this point in the history
 fix kv test
  • Loading branch information
huangminghuang authored Oct 19, 2021
2 parents e7b289c + 8349ed4 commit ba30888
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
15 changes: 12 additions & 3 deletions unittests/kv_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,17 @@ class kv_tester : public tester {

void itstaterased(const char* error, name contract, const char* prefix, const char* k, const char* v,
int test_id, bool insert, bool reinsert) {
BOOST_REQUIRE_EQUAL(error, push_action("itstaterased"_n, mvo()("contract", contract)("prefix", prefix)(
"k", k)("v", v)("test_id", test_id)("insert", insert)("reinsert", reinsert)));
BOOST_REQUIRE_MESSAGE(
error == push_action("itstaterased"_n, mvo()("contract", contract)("prefix", prefix)("k", k)("v", v)(
"test_id", test_id)("insert", insert)("reinsert", reinsert)),
error << "!= push_action(\"itstaterased\"_n, mvo()(\"contract\", " << contract
<< ")(\"prefix\","<< prefix
<< ")(\"k\"," << k
<< ")(\"v\"," << v
<< ")(\"test_id\"," << test_id
<< ")(\"insert\"," << insert
<< ")(\"reinsert\"," << reinsert << "))"
);
}

uint64_t get_usage(name account="kvtest"_n) {
Expand Down Expand Up @@ -418,7 +427,7 @@ class kv_tester : public tester {
// pre-inserted
for(bool insert : {false, true}) {
for(int i = 0; i < 8; ++i) {
setmany("", "kvtest"_n, { kv{ { 0x22 }, { 0x12 } } });
setmany("", "kvtest"_n, {kv{{0x22}, {0x12}}});
produce_block();
itstaterased("Iterator to erased element", "kvtest"_n, "", "22", "12", i, insert, reinsert );
}
Expand Down
3 changes: 3 additions & 0 deletions unittests/test-contracts/kv_test/kv_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ class [[eosio::contract("kv_test")]] kvtest : public eosio::contract {
case 3: {
auto it2 = kv_it_create(contract.value, prefix.data(), prefix.size());
kv_it_compare(it2, it); // abort
return;
}
case 4: {
kv_it_compare(it, it); // abort
return;
}
Expand Down

0 comments on commit ba30888

Please sign in to comment.