Skip to content

Commit

Permalink
add test for settings class
Browse files Browse the repository at this point in the history
  • Loading branch information
toxeus committed Jun 13, 2018
1 parent d856360 commit 5ba61b4
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ test_libbitcoin_test_LDFLAGS = ${boost_LDFLAGS}
test_libbitcoin_test_LDADD = src/libbitcoin.la ${boost_unit_test_framework_LIBS} ${boost_chrono_LIBS} ${boost_date_time_LIBS} ${boost_filesystem_LIBS} ${boost_iostreams_LIBS} ${boost_locale_LIBS} ${boost_log_LIBS} ${boost_program_options_LIBS} ${boost_regex_LIBS} ${boost_system_LIBS} ${boost_thread_LIBS} ${pthread_LIBS} ${rt_LIBS} ${icu_i18n_LIBS} ${dl_LIBS} ${png_LIBS} ${qrencode_LIBS} ${secp256k1_LIBS}
test_libbitcoin_test_SOURCES = \
test/main.cpp \
test/settings.cpp \
test/chain/block.cpp \
test/chain/compact.cpp \
test/chain/header.cpp \
Expand Down
44 changes: 44 additions & 0 deletions test/settings.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright (c) 2011-2018 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 <boost/test/unit_test.hpp>
#include <bitcoin/bitcoin.hpp>

using namespace bc;

BOOST_AUTO_TEST_SUITE(settings_tests)

// constructors
//-----------------------------------------------------------------------------

BOOST_AUTO_TEST_CASE(settings__construct__default_context__expected)
{
settings configuration;
BOOST_REQUIRE_EQUAL(configuration.retargeting_factor, 4);
BOOST_REQUIRE_EQUAL(configuration.target_spacing_seconds, 600);
BOOST_REQUIRE_EQUAL(configuration.easy_spacing_seconds, 1200);
BOOST_REQUIRE_EQUAL(configuration.timestamp_future_seconds, 7200);
BOOST_REQUIRE_EQUAL(configuration.target_timespan_seconds, 1209600);
BOOST_REQUIRE_EQUAL(configuration.retarget_proof_of_work_limit, 0x1d00ffff);
BOOST_REQUIRE_EQUAL(configuration.no_retarget_proof_of_work_limit, 0x207fffff);
BOOST_REQUIRE_EQUAL(configuration.min_timespan, 302400);
BOOST_REQUIRE_EQUAL(configuration.max_timespan, 4838400);
BOOST_REQUIRE_EQUAL(configuration.retargeting_interval, 2016);
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 5ba61b4

Please sign in to comment.