Merge pull request #459 from ethereum/mocked-host-nonce

mocked_host: add nonce to account
This commit is contained in:
Alex Beregszaszi 2019-11-28 15:27:26 +01:00 committed by GitHub
commit c1959de7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,9 @@ struct MockedAccount
{}
};
/// The account nonce.
int nonce = 0;
/// The account code.
bytes code;

View File

@ -633,4 +633,18 @@ TEST(cpp, result_create)
ASSERT_TRUE(c.release);
EXPECT_TRUE(std::memcmp(c.output_data, r.output_data, c.output_size) == 0);
c.release(&c);
}
}
TEST(cpp, mocked_account)
{
using namespace evmc::literals;
evmc::MockedAccount account;
EXPECT_EQ(account.nonce, 0);
--account.nonce;
account.set_balance(0x0102030405060708);
EXPECT_EQ(account.balance,
0x0000000000000000000000000000000000000000000000000102030405060708_bytes32);
EXPECT_EQ(account.nonce, -1);
}