mirror of https://github.com/status-im/evmc.git
Merge pull request #459 from ethereum/mocked-host-nonce
mocked_host: add nonce to account
This commit is contained in:
commit
c1959de7d1
|
@ -35,6 +35,9 @@ struct MockedAccount
|
|||
{}
|
||||
};
|
||||
|
||||
/// The account nonce.
|
||||
int nonce = 0;
|
||||
|
||||
/// The account code.
|
||||
bytes code;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue