Fabcoin Core
0.16.2
P2P Digital Currency
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
src
cpp-ethereum
test
libtesteth
TestUtils.h
Go to the documentation of this file.
1
/*
2
This file is part of cpp-ethereum.
3
4
cpp-ethereum is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
cpp-ethereum is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
16
*/
20
#pragma once
21
22
#include <functional>
23
#include <string>
24
#include <json/json.h>
25
#include <
libdevcore/TransientDirectory.h
>
26
#include <
libethereum/BlockChain.h
>
27
#include <
libethereum/ClientBase.h
>
28
29
namespace
dev
30
{
31
namespace
test
32
{
33
34
// should be used for multithread tests
35
static
SharedMutex
x_boostTest;
36
#define ETH_CHECK_EQUAL(x, y) { dev::WriteGuard(x_boostTest); BOOST_CHECK_EQUAL(x, y); }
37
#define ETH_CHECK_EQUAL_COLLECTIONS(xb, xe, yb, ye) { dev::WriteGuard(x_boostTest); BOOST_CHECK_EQUAL_COLLECTIONS(xb, xe, yb, ye); }
38
#define ETH_REQUIRE(x) { dev::WriteGuard(x_boostTest); BOOST_REQUIRE(x); }
39
40
struct
LoadTestFileFixture
41
{
42
LoadTestFileFixture
();
43
44
protected
:
45
Json::Value
m_json
;
46
};
47
48
struct
ParallelFixture
49
{
50
void
enumerateThreads(
std::function
<
void
()> callback)
const
;
51
};
52
53
struct
BlockChainFixture
:
public
LoadTestFileFixture
54
{
55
void
enumerateBlockchains(
std::function
<
void
(
Json::Value
const
&,
dev::eth::BlockChain
const
&,
dev::eth::State
state)> callback)
const
;
56
};
57
58
struct
ClientBaseFixture
:
public
BlockChainFixture
59
{
60
void
enumerateClients(
std::function
<
void
(
Json::Value
const
&,
dev::eth::ClientBase
&)> callback)
const
;
61
};
62
63
// important BOOST TEST do have problems with thread safety!!!
64
// BOOST_CHECK is not thread safe
65
// BOOST_MESSAGE is not thread safe
66
// http://boost.2283326.n4.nabble.com/Is-boost-test-thread-safe-td3471644.html
67
// http://lists.boost.org/boost-users/2010/03/57691.php
68
// worth reading
69
// https://codecrafter.wordpress.com/2012/11/01/c-unit-test-framework-adapter-part-3/
70
struct
ParallelClientBaseFixture
:
public
ClientBaseFixture
,
public
ParallelFixture
71
{
72
void
enumerateClients(
std::function
<
void
(
Json::Value
const
&,
dev::eth::ClientBase
&)> callback)
const
;
73
};
74
75
struct
JsonRpcFixture
:
public
ClientBaseFixture
76
{
77
78
};
79
80
}
81
}
dev
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
Definition:
Arith256.cpp:15
function
#define function(a, b, c, d, k, s)
ClientBase.h
dev::test::LoadTestFileFixture
Definition:
TestUtils.h:40
dev::eth::BlockChain
Implements the blockchain database.
Definition:
BlockChain.h:105
dev::test::JsonRpcFixture
Definition:
TestUtils.h:75
test
dev::test::ParallelClientBaseFixture
Definition:
TestUtils.h:70
dev::eth::State
Model of an Ethereum state, essentially a facade for the trie.
Definition:
State.h:161
dev::test::ParallelFixture
Definition:
TestUtils.h:48
dev::test::LoadTestFileFixture::m_json
Json::Value m_json
Definition:
TestUtils.h:45
BlockChain.h
dev::test::ClientBaseFixture
Definition:
TestUtils.h:58
json_spirit::Value
Config::Value_type Value
Definition:
json_spirit_value.h:139
dev::test::LoadTestFileFixture::LoadTestFileFixture
LoadTestFileFixture()
Definition:
TestUtils.cpp:70
TransientDirectory.h
dev::SharedMutex
boost::shared_mutex SharedMutex
Definition:
Guards.h:39
dev::test::BlockChainFixture
Definition:
TestUtils.h:53
dev::eth::ClientBase
Definition:
ClientBase.h:76
Generated on Mon Oct 22 2018 15:15:29 for Fabcoin Core by
1.8.11