Fix tests better
The solution being used for initializing the boost test modules is now deprecated, so update it to use the global test fixture instead
This commit is contained in:
parent
8a6bae6006
commit
906ffa6351
7 changed files with 75 additions and 82 deletions
|
|
@ -2860,21 +2860,14 @@ BOOST_AUTO_TEST_CASE( wimbledon_2017_gentelmen_singles_final_test )
|
|||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
|
||||
|
||||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
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;
|
||||
GRAPHENE_TESTING_GENESIS_TIMESTAMP = HARDFORK_1000_TIME.sec_since_epoch() + 2;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,18 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
#define BOOST_TEST_MODULE Intense Tests
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@
|
|||
BOOST_AUTO_TEST_CASE(peerplays_sidechain) {
|
||||
}
|
||||
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
boost::unit_test::test_suite *init_unit_test_suite(int argc, char *argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -134,12 +134,10 @@ BOOST_FIXTURE_TEST_CASE( basic, database_fixture )
|
|||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
//#define BOOST_TEST_MODULE "C++ Unit Tests for Graphene Blockchain Database"
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
auto argc = boost::unit_test::framework::master_test_suite().argc;
|
||||
auto argv = boost::unit_test::framework::master_test_suite().argv;
|
||||
for (int i=1; i<argc; i++)
|
||||
{
|
||||
const std::string arg = argv[i];
|
||||
|
|
@ -153,5 +151,7 @@ boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
|||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
if (signal(SIGPIPE, sig_handler) == SIG_ERR)
|
||||
std::cout << "Can't catch SIGPIPE signal!" << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,20 +21,20 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#define BOOST_TEST_MODULE Tests
|
||||
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP;
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
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;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/test/included/unit_test.hpp>
|
||||
|
||||
boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
|
||||
struct GlobalInitializationFixture {
|
||||
GlobalInitializationFixture() {
|
||||
std::srand(time(NULL));
|
||||
std::cout << "Random number generator seeded to " << time(NULL) << std::endl;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
BOOST_TEST_GLOBAL_FIXTURE(GlobalInitializationFixture);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue