[kutil] Fix failing heap allocator tests
The tests clearly haven't even been built in a while. I've added a helper script to the project root. Also added a kassert() handler that will allow tests to catch or fail on asserts.
This commit is contained in:
@@ -1,2 +1,29 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#define CATCH_CONFIG_RUNNER
|
||||
#include "catch.hpp"
|
||||
|
||||
#include "kutil/assert.h"
|
||||
|
||||
bool ASSERT_EXPECTED = false;
|
||||
bool ASSERT_HAPPENED = false;
|
||||
void test_assert(const char *file, unsigned line, const char *message)
|
||||
{
|
||||
CAPTURE( file );
|
||||
CAPTURE( line );
|
||||
INFO( message );
|
||||
REQUIRE( ASSERT_EXPECTED );
|
||||
ASSERT_EXPECTED = false;
|
||||
ASSERT_HAPPENED = true;
|
||||
}
|
||||
|
||||
|
||||
int main( int argc, char* argv[] ) {
|
||||
kutil::assert_set_callback(test_assert);
|
||||
|
||||
int result = Catch::Session().run( argc, argv );
|
||||
return result;
|
||||
}
|
||||
|
||||
namespace kutil {
|
||||
void * kalloc(size_t size) { return malloc(size); }
|
||||
void kfree(void *p) { return free(p); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user