added assert

Signed-off-by: h4570 <sandro.sobczynski@gmail.com>
This commit is contained in:
h4570
2021-05-25 21:30:21 +02:00
parent d0d7ed85e5
commit d8458b98e0
2 changed files with 20 additions and 8 deletions
+4
View File
@@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Unit tests
- Assert
### Changed
- All PRINT_LOG and PRINT_ERR to consoleLog() and assertMsg()
## [1.31.2] - 2021-02-06
+16 -8
View File
@@ -11,14 +11,18 @@
#ifndef _TYRA_DEBUG_
#define _TYRA_DEBUG_
#include <tamtypes.h>
#include <math3d.h>
#include <stdio.h>
#ifdef NDEBUG
#define consoleLog(message) ((void)0)
#define assertMsg(condition, message) ((void)0)
#define PRINT_LOG(TEXT) ((void)0) // DELETE ME
#define PRINT_ERR(TEXT) ((void)0) // DELETE ME
#else // IF Debug
#include <stdio.h>
class Debug
{
public:
static void errTrap(char *t_text, char *t_file)
static void trap(const char *t_text, const char *t_file)
{
printf("\n");
printf("====================================\n");
@@ -29,8 +33,12 @@ public:
;
}
};
#define consoleLog(message) printf("LOG: " message " (" __FILE__ ")\n")
#define assertMsg(condition, message) \
if (!(condition)) \
Debug::trap(message, __FILE__)
#define PRINT_LOG(TEXT) printf("LOG: " TEXT " (" __FILE__ ")\n") // DELETE ME
#define PRINT_ERR(TEXT) Debug::trap(TEXT, __FILE__) // DELETE ME
#endif // NDEBUG
#define PRINT_LOG(TEXT) printf("LOG: " TEXT " (" __FILE__ ")\n")
#define PRINT_ERR(TEXT) Debug::errTrap(TEXT, __FILE__)
#endif
#endif // _TYRA_DEBUG_