engine: add simple unit-testing (v3?)

This commit is contained in:
Alibek Omarov
2021-06-20 19:59:16 +03:00
parent 5bc4359a2f
commit 6ea25b8194
3 changed files with 71 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef TESTS_H
#define TESTS_H
#if XASH_ENGINE_TESTS
struct tests_stats_s
{
uint passed;
uint failed;
};
extern struct tests_stats_s tests_stats;
#define TRUN( x ) Msg( "Running " #x "\n" ); x
#define TASSERT( exp ) \
if(!( exp )) \
{ \
tests_stats.failed++; \
Msg( "assert failed at %s:%i\n", __FILE__, __LINE__ ) \
} \
else tests_stats.passed++;
void Test_RunLibCommon( void );
#endif
#endif /* TESTS_H */