Move must_alloc into test.h
This commit is contained in:
parent
025fd61abd
commit
84f127bfec
2 changed files with 10 additions and 10 deletions
10
src/test.h
10
src/test.h
|
|
@ -127,6 +127,16 @@ test_main(int argc, const char **argv, struct testdef tests[])
|
|||
return allok ? 0 : 1;
|
||||
}
|
||||
|
||||
static void *
|
||||
must_alloc(testctx t, size_t size)
|
||||
{
|
||||
void *out = malloc(size);
|
||||
if (out == NULL) {
|
||||
test_fatalf(t, "Failed allocating %d bytes of memory", size);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
#define TESTS_BEGIN \
|
||||
int main(int argc, const char **argv) \
|
||||
{ \
|
||||
|
|
|
|||
|
|
@ -4,16 +4,6 @@
|
|||
|
||||
#include "test.h"
|
||||
|
||||
static void *
|
||||
must_alloc(testctx t, size_t size)
|
||||
{
|
||||
void *out = malloc(size);
|
||||
if (out == NULL) {
|
||||
test_fatalf(t, "Failed allocating %d bytes of memory", size);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
struct tokenizer_test {
|
||||
testctx t;
|
||||
apfl_tokenizer_ptr tokenizer;
|
||||
|
|
|
|||
Loading…
Reference in a new issue