Browse Source
pull/1/headad49c25
Split up util.cpp/h (Wladimir J. van der Laan)f841aa2
Move `COIN` and `CENT` to core.h (Wladimir J. van der Laan)6e5fd00
Move `*Version()` functions to version.h/cpp (Wladimir J. van der Laan)b4aa769
Move `S_I*` constants and `MSG_NOSIGNAL` to compat.h (Wladimir J. van der Laan)af8297c
Move functions in wallet.h to implementation file (Wladimir J. van der Laan)651480c
move functions in main and net to implementation files (Wladimir J. van der Laan)610a8c0
Move SetThreadPriority implementation to util.cpp instead of the header (Wladimir J. van der Laan)f780e65
Remove unused function `ByteReverse` from util.h (Wladimir J. van der Laan)121d6ad
Remove unused `alignup` function from util.h (Wladimir J. van der Laan)d1e26d4
Move CMedianFilter to timedata.cpp (Wladimir J. van der Laan)
66 changed files with 1294 additions and 1131 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT/X11 software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
//
|
||||
#include "timedata.h" |
||||
|
||||
#include <boost/test/unit_test.hpp> |
||||
|
||||
using namespace std; |
||||
|
||||
BOOST_AUTO_TEST_SUITE(timedata_tests) |
||||
|
||||
BOOST_AUTO_TEST_CASE(util_MedianFilter) |
||||
{ |
||||
CMedianFilter<int> filter(5, 15); |
||||
|
||||
BOOST_CHECK_EQUAL(filter.median(), 15); |
||||
|
||||
filter.input(20); // [15 20]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 17); |
||||
|
||||
filter.input(30); // [15 20 30]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 20); |
||||
|
||||
filter.input(3); // [3 15 20 30]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 17); |
||||
|
||||
filter.input(7); // [3 7 15 20 30]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 15); |
||||
|
||||
filter.input(18); // [3 7 18 20 30]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 18); |
||||
|
||||
filter.input(0); // [0 3 7 18 30]
|
||||
BOOST_CHECK_EQUAL(filter.median(), 7); |
||||
} |
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() |