From efa4be3eca0e69b3f1ea8f640631b899d20f4856 Mon Sep 17 00:00:00 2001 From: Konstantin Munichev Date: Thu, 8 Nov 2018 20:02:13 +0300 Subject: [PATCH] Move OrderingGateFixture to fuzzing namespace Signed-off-by: Konstantin Munichev --- test/fuzzing/ordering_gate_fuzz.cpp | 61 ++++++++++++++++------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/test/fuzzing/ordering_gate_fuzz.cpp b/test/fuzzing/ordering_gate_fuzz.cpp index cdec677d93..1335c8bb23 100644 --- a/test/fuzzing/ordering_gate_fuzz.cpp +++ b/test/fuzzing/ordering_gate_fuzz.cpp @@ -14,38 +14,43 @@ using namespace iroha::ordering; using namespace testing; -struct OrderingGateFixture { - std::shared_ptr block_factory_; - std::shared_ptr> ordering_service_; - std::shared_ptr> network_client_; +namespace fuzzing { + struct OrderingGateFixture { + std::shared_ptr block_factory_; + std::shared_ptr> ordering_service_; + std::shared_ptr> network_client_; - rxcpp::subjects::subject rounds_; - NiceMock *proposal_factory_; - std::shared_ptr ordering_gate_; - iroha::consensus::Round initial_round_ = {2, 1}; + rxcpp::subjects::subject rounds_; + NiceMock *proposal_factory_; + std::shared_ptr ordering_gate_; + iroha::consensus::Round initial_round_ = {2, 1}; - OrderingGateFixture() - : block_factory_(std::make_shared( - std::make_unique< - shared_model::validation::DefaultUnsignedBlockValidator>())), - ordering_service_( - std::make_shared>()), - network_client_( - std::make_shared>()) { - auto proposal_factory = - std::make_unique>(); - proposal_factory_ = proposal_factory.get(); - ordering_gate_ = - std::make_shared(ordering_service_, - network_client_, - rounds_.get_observable(), - std::move(proposal_factory), - initial_round_); - } -}; + OrderingGateFixture() + : block_factory_(std::make_shared< + shared_model::proto::ProtoBlockFactory>( + std::make_unique< + shared_model::validation::DefaultUnsignedBlockValidator>())), + ordering_service_( + std::make_shared> + + ()), + network_client_( + std::make_shared>()) { + auto proposal_factory = + std::make_unique>(); + proposal_factory_ = proposal_factory.get(); + ordering_gate_ = + std::make_shared(ordering_service_, + network_client_, + rounds_.get_observable(), + std::move(proposal_factory), + initial_round_); + } + }; +} // namespace fuzzing extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, std::size_t size) { - static OrderingGateFixture ordering_gate_fixture; + static fuzzing::OrderingGateFixture ordering_gate_fixture; if (size < 1) { return 0; }