database_fixture.cpp: Make GRAPHENE_TESTING_GENESIS_TIMESTAMP configurable #427

This commit is contained in:
theoreticalbts 2015-10-30 19:12:05 -04:00
parent 1559df551a
commit fabe83fbad
3 changed files with 11 additions and 1 deletions

View file

@ -46,6 +46,8 @@
using namespace graphene::chain::test; using namespace graphene::chain::test;
uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP = 1431700000;
namespace graphene { namespace chain { namespace graphene { namespace chain {
using std::cout; using std::cout;

View file

@ -29,7 +29,7 @@
using namespace graphene::db; using namespace graphene::db;
#define GRAPHENE_TESTING_GENESIS_TIMESTAMP (1431700000) extern uint32_t GRAPHENE_TESTING_GENESIS_TIMESTAMP;
#define PUSH_TX \ #define PUSH_TX \
graphene::chain::test::_push_transaction graphene::chain::test::_push_transaction

View file

@ -23,8 +23,16 @@
#include <iostream> #include <iostream>
#include <boost/test/included/unit_test.hpp> #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[]) { boost::unit_test::test_suite* init_unit_test_suite(int argc, char* argv[]) {
std::srand(time(NULL)); std::srand(time(NULL));
std::cout << "Random number generator seeded to " << time(NULL) << std::endl; 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; return nullptr;
} }