Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,16 @@ check_PROGRAMS = test/libbitcoin-server-test
test_libbitcoin_server_test_CPPFLAGS = -I${srcdir}/include ${bitcoin_node_BUILD_CPPFLAGS}
test_libbitcoin_server_test_LDADD = src/libbitcoin-server.la ${boost_unit_test_framework_LIBS} ${bitcoin_node_LIBS}
test_libbitcoin_server_test_SOURCES = \
test/configuration.cpp \
test/error.cpp \
test/main.cpp \
test/settings.cpp \
test/test.cpp \
test/test.hpp
test/test.hpp \
test/parsers/bitcoind_query.cpp \
test/parsers/bitcoind_target.cpp \
test/parsers/explore_query.cpp \
test/parsers/explore_target.cpp

endif WITH_TESTS

Expand Down
8 changes: 7 additions & 1 deletion builds/cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,16 @@ target_link_libraries( ${CANONICAL_LIB_NAME}
#------------------------------------------------------------------------------
if (with-tests)
add_executable( libbitcoin-server-test
"../../test/configuration.cpp"
"../../test/error.cpp"
"../../test/main.cpp"
"../../test/settings.cpp"
"../../test/test.cpp"
"../../test/test.hpp" )
"../../test/test.hpp"
"../../test/parsers/bitcoind_query.cpp"
"../../test/parsers/bitcoind_target.cpp"
"../../test/parsers/explore_query.cpp"
"../../test/parsers/explore_target.cpp" )

add_test( NAME libbitcoin-server-test COMMAND libbitcoin-server-test
--run_test=*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,14 @@
<Import Project="$(ProjectDir)$(ProjectName).props" />
</ImportGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\configuration.cpp" />
<ClCompile Include="..\..\..\..\test\error.cpp" />
<ClCompile Include="..\..\..\..\test\main.cpp" />
<ClCompile Include="..\..\..\..\test\parsers\bitcoind_query.cpp" />
<ClCompile Include="..\..\..\..\test\parsers\bitcoind_target.cpp" />
<ClCompile Include="..\..\..\..\test\parsers\explore_query.cpp" />
<ClCompile Include="..\..\..\..\test\parsers\explore_target.cpp" />
<ClCompile Include="..\..\..\..\test\settings.cpp" />
<ClCompile Include="..\..\..\..\test\test.cpp" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,35 @@
<Filter Include="src">
<UniqueIdentifier>{66A0E586-2E3A-448F-0000-000000000000}</UniqueIdentifier>
</Filter>
<Filter Include="src\parsers">
<UniqueIdentifier>{66A0E586-2E3A-448F-0000-000000000001}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\..\test\configuration.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\error.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\main.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\parsers\bitcoind_query.cpp">
<Filter>src\parsers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\parsers\bitcoind_target.cpp">
<Filter>src\parsers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\parsers\explore_query.cpp">
<Filter>src\parsers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\parsers\explore_target.cpp">
<Filter>src\parsers</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\settings.cpp">
<Filter>src</Filter>
</ClCompile>
<ClCompile Include="..\..\..\..\test\test.cpp">
<Filter>src</Filter>
</ClCompile>
Expand Down
52 changes: 52 additions & 0 deletions test/configuration.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "test.hpp"

BOOST_AUTO_TEST_SUITE(configuration_tests)

BOOST_AUTO_TEST_CASE(configuration__construct1__none_context__expected)
{
const settings::embedded_pages web{};
const settings::embedded_pages explorer{};
const configuration instance(system::chain::selection::none, explorer, web);

BOOST_REQUIRE(instance.file.empty());
BOOST_REQUIRE(!instance.help);
BOOST_REQUIRE(!instance.hardware);
BOOST_REQUIRE(!instance.settings);
BOOST_REQUIRE(!instance.version);
BOOST_REQUIRE(!instance.newstore);
BOOST_REQUIRE(!instance.backup);
BOOST_REQUIRE(!instance.restore);
BOOST_REQUIRE(!instance.flags);
BOOST_REQUIRE(!instance.information);
BOOST_REQUIRE(!instance.slabs);
BOOST_REQUIRE(!instance.buckets);
BOOST_REQUIRE(!instance.collisions);
BOOST_REQUIRE_EQUAL(instance.test, system::null_hash);
BOOST_REQUIRE_EQUAL(instance.write, system::null_hash);

// Just a sample of settings.
BOOST_REQUIRE(instance.node.headers_first);
BOOST_REQUIRE_EQUAL(instance.network.threads, 1_u32);
BOOST_REQUIRE_EQUAL(instance.bitcoin.first_version, 1_u32);
BOOST_REQUIRE_EQUAL(instance.log.application, network::levels::application_defined);
}

BOOST_AUTO_TEST_SUITE_END()
28 changes: 28 additions & 0 deletions test/parsers/bitcoind_query.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../test.hpp"

BOOST_AUTO_TEST_SUITE(bitcoind_query_tests)

BOOST_AUTO_TEST_CASE(bitcoind_query_test)
{
BOOST_REQUIRE(true);
}

BOOST_AUTO_TEST_SUITE_END()
28 changes: 28 additions & 0 deletions test/parsers/bitcoind_target.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../test.hpp"

BOOST_AUTO_TEST_SUITE(bitcoind_target_tests)

BOOST_AUTO_TEST_CASE(bitcoind_target_test)
{
BOOST_REQUIRE(true);
}

BOOST_AUTO_TEST_SUITE_END()
31 changes: 31 additions & 0 deletions test/parsers/explore_query.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS)
*
* This file is part of libbitcoin.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "../test.hpp"

BOOST_AUTO_TEST_SUITE(explore_query_tests)

using namespace network::http;

BOOST_AUTO_TEST_CASE(parsers__explore_query__empty__false)
{
network::rpc::request_t out{};
BOOST_REQUIRE(!explore_query(out, network::http::request{}));
}

BOOST_AUTO_TEST_SUITE_END()
Loading
Loading