Skip to content

Commit c7c3262

Browse files
committed
Merge pull request #3768
fecba4e Total money limit test (Pieter Wuille)
2 parents 9b7449b + fecba4e commit c7c3262

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/test/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ test_bitcoin_SOURCES = \
4545
DoS_tests.cpp \
4646
getarg_tests.cpp \
4747
key_tests.cpp \
48+
main_tests.cpp \
4849
miner_tests.cpp \
4950
mruset_tests.cpp \
5051
multisig_tests.cpp \

src/test/main_tests.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include "core.h"
2+
#include "main.h"
3+
4+
#include <boost/test/unit_test.hpp>
5+
6+
BOOST_AUTO_TEST_SUITE(main_tests)
7+
8+
BOOST_AUTO_TEST_CASE(subsidy_limit_test)
9+
{
10+
uint64_t nSum = 0;
11+
for (int nHeight = 0; nHeight < 7000000; nHeight += 1000) {
12+
uint64_t nSubsidy = GetBlockValue(nHeight, 0);
13+
BOOST_CHECK(nSubsidy <= 50 * COIN);
14+
nSum += nSubsidy * 1000;
15+
BOOST_CHECK(MoneyRange(nSum));
16+
}
17+
BOOST_CHECK(nSum == 2099999997690000ULL);
18+
}
19+
20+
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)