diff --git a/tests/betting/betting_tests.cpp b/tests/betting/betting_tests.cpp index 09ed9c38..2732d874 100644 --- a/tests/betting/betting_tests.cpp +++ b/tests/betting/betting_tests.cpp @@ -2860,21 +2860,14 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_final_test ) BOOST_AUTO_TEST_SUITE_END() +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - -//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database" -#include -#include -#include - -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - - // betting operations don't take effect until HARDFORK 1000 - GRAPHENE_TESTING_GENESIS_TIMESTAMP = - (HARDFORK_1000_TIME.sec_since_epoch() + 15) / GRAPHENE_DEFAULT_BLOCK_INTERVAL * GRAPHENE_DEFAULT_BLOCK_INTERVAL; - - return nullptr; -} + // betting operations don't take effect until HARDFORK 1000 + GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); diff --git a/tests/intense/main.cpp b/tests/intense/main.cpp index c337407f..b2b2a6cb 100644 --- a/tests/intense/main.cpp +++ b/tests/intense/main.cpp @@ -21,12 +21,18 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#include -#include -#include -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - return nullptr; -} +#define BOOST_TEST_MODULE Intense Tests + +#include + +#include + +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); + diff --git a/tests/peerplays_sidechain/peerplays_sidechain_tests.cpp b/tests/peerplays_sidechain/peerplays_sidechain_tests.cpp index d14fa602..ca2de270 100644 --- a/tests/peerplays_sidechain/peerplays_sidechain_tests.cpp +++ b/tests/peerplays_sidechain/peerplays_sidechain_tests.cpp @@ -5,13 +5,11 @@ BOOST_AUTO_TEST_CASE(peerplays_sidechain) { } -#include -#include -#include +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); -boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - - return nullptr; -} diff --git a/tests/performance/performance_tests.cpp b/tests/performance/performance_tests.cpp index 5f36a3fc..c3fc2d74 100644 --- a/tests/performance/performance_tests.cpp +++ b/tests/performance/performance_tests.cpp @@ -74,13 +74,11 @@ BOOST_AUTO_TEST_CASE( transfer_benchmark ) //BOOST_AUTO_TEST_SUITE_END() -//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database" -#include -#include -#include +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - return nullptr; -} diff --git a/tests/random/random_tests.cpp b/tests/random/random_tests.cpp index db30658d..10c19d75 100644 --- a/tests/random/random_tests.cpp +++ b/tests/random/random_tests.cpp @@ -134,24 +134,24 @@ BOOST_FIXTURE_TEST_CASE( basic, database_fixture ) BOOST_AUTO_TEST_SUITE_END() -//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database" -#include -#include -#include - -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - for (int i=1; i #include #include extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP; -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - const char* genesis_timestamp_str = getenv("GRAPHENE_TESTING_GENESIS_TIMESTAMP"); - if( genesis_timestamp_str != nullptr ) - { - GRAPHENE_TESTING_GENESIS_TIMESTAMP = std::stoul( genesis_timestamp_str ); - } - std::cout << "GRAPHENE_TESTING_GENESIS_TIMESTAMP is " << GRAPHENE_TESTING_GENESIS_TIMESTAMP << std::endl; - return nullptr; -} +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); + diff --git a/tests/tournament/tournament_tests.cpp b/tests/tournament/tournament_tests.cpp index ba0cffe2..6ebd047a 100644 --- a/tests/tournament/tournament_tests.cpp +++ b/tests/tournament/tournament_tests.cpp @@ -2259,13 +2259,11 @@ BOOST_FIXTURE_TEST_CASE( massive, database_fixture ) BOOST_AUTO_TEST_SUITE_END() -//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database" -#include -#include -#include +struct GlobalInitializationFixture { + GlobalInitializationFixture() { + std::srand(time(NULL)); + std::cout << "Random number generator seeded to " << time(NULL) << std::endl; + } +}; +BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture); -boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) { - std::srand(time(NULL)); - std::cout << "Random number generator seeded to " << time(NULL) << std::endl; - return nullptr; -}