ModEasy, a c++ library, is an easy to add modding system that is functional out of the box, but also designed to be extendable for whatever you may need.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

79 lines
3.4 KiB

//copied and modified from https://github.com/Submanifold/Aleph 's test setup (MIT)
#ifndef UNIT_TEST_BASE_H__
#define UNIT_TEST_BASE_H__
#include <iostream>
#include <stdexcept>
#include <string>
namespace UnitTests
{
#define ASSERT_EQUAL( x, y ) \
{ \
if( ( x ) != ( y ) ) \
{ \
throw std::runtime_error( std::string( __FILE__ ) \
+ std::string( ":" ) \
+ std::to_string( __LINE__ ) \
+ std::string( " in " ) \
+ std::string( __PRETTY_FUNCTION__ ) \
+ std::string( ": " ) \
+ std::to_string( ( x ) ) \
+ std::string( " != " ) \
+ std::to_string( ( y ) ) \
); \
} \
}
#define ASSERT_THROW( condition ) \
{ \
if( !( condition ) ) \
{ \
throw std::runtime_error( std::string( "Assert Failed: " ) \
+ std::string( __FILE__ ) \
+ std::string( ":" ) \
+ std::to_string( __LINE__ ) \
+ std::string( " in " ) \
+ std::string( __PRETTY_FUNCTION__ ) \
); \
} \
}
#define EXPECT_EXCEPTION( expression, exception ) \
{ \
try \
{ \
( expression ); \
} \
catch( exception& e ) \
{ \
} \
catch( ... ) \
{ \
throw std::runtime_error( std::string( __FILE__ ) \
+ std::string( ":" ) \
+ std::to_string( __LINE__ ) \
+ std::string( " in " ) \
+ std::string( __PRETTY_FUNCTION__ ) \
); \
} \
}
#define TEST_BEGIN( name )\
{\
std::cerr << "-- Running test \"" << name << "\"...";\
}
#define TEST_END() \
{\
std::cerr << "finished\n";\
}
}
#endif