I'm a tabs guy. I like tabs, it's an elegant way to represent indentation instead of brute-forcing it. But I have to admit that the world seems to be going towards spaces, and tooling tends not to play nice with tabs. So here we go, changing the whole repo to spaces since I'm getting tired of all the inconsistent formatting.
30 lines
636 B
C++
30 lines
636 B
C++
#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); }
|
|
}
|