unit_test_init_cleanup.hpp 1.06 KB
Newer Older
incardon's avatar
incardon committed
1 2 3 4 5 6 7 8 9 10
/*
 * unit_test_init_cleanup.hpp
 *
 *  Created on: Apr 17, 2015
 *      Author: Pietro Incardona
 */

#ifndef UNIT_TEST_INIT_CLEANUP_HPP_
#define UNIT_TEST_INIT_CLEANUP_HPP_

incardon's avatar
incardon committed
11
#include "VCluster/VCluster.hpp"
incardon's avatar
incardon committed
12

incardon's avatar
incardon committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
const char * test_dir;

struct ut_start
{
	//!
    ut_start()
    {
    	BOOST_TEST_MESSAGE("Initialize global VCluster");

    	openfpm_init(&boost::unit_test::framework::master_test_suite().argc,&boost::unit_test::framework::master_test_suite().argv);

#ifdef PERFORMANCE_TEST
    	test_dir = getenv("OPENFPM_PERFORMANCE_TEST_DIR");

    	if (test_dir == NULL)
    	{
    		std::cerr << "Error: " __FILE__ << ":" << __LINE__ << " in order to run the performance test you must set the environment variable $OPENFPM_PERFORMANCE_TEST_DIR to the test or an empty directory";
    		exit(1);
    	}
#endif
    }

    ~ut_start()
    {
    	BOOST_TEST_MESSAGE("Delete global VClster");
    	openfpm_finalize();
    }
incardon's avatar
incardon committed
40 41 42 43 44 45 46 47 48
};

//____________________________________________________________________________//

BOOST_GLOBAL_FIXTURE( ut_start );



#endif /* UNIT_TEST_INIT_CLEANUP_HPP_ */