dpkg 1.21.11
Macros
test.h File Reference

(566c21f4d)

#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <dpkg/macros.h>
#include <dpkg/ehandle.h>
Include dependency graph for test.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TEST_MAIN_CTOR   push_error_context()
 
#define TEST_MAIN_DTOR   pop_error_context(ehflag_normaltidy)
 
#define test_bail(reason)
 
#define test_xstringify(str)    #str
 
#define test_stringify(str)    test_xstringify(str)
 
#define test_alloc(ptr)    test_alloc((ptr), "cannot allocate memory for " #ptr " in " __FILE__ ":" test_stringify(__LINE__))
 
#define test_try(jmp)
 
#define test_catch    else
 
#define test_finally    pop_error_context(ehflag_normaltidy);
 
#define test_get_srcdir()    test_get_envdir("srcdir")
 
#define test_get_builddir()    test_get_envdir("builddir")
 
#define test_plan(n)    printf("1..%d\n", n);
 
#define test_skip_all(reason)
 
#define test_skip(reason)    printf("ok %d # SKIP %s\n", test_id++, (reason))
 
#define test_skip_block(cond)
 
#define test_todo(a, reason, desc)
 
#define test_todo_block(reason)
 
#define test_case(a, fmt, ...)
 
#define test_pass(a)    test_case((a), "pass %s", #a)
 
#define test_fail(a)    test_case(!(a), "fail %s", #a)
 
#define test_str(a, op, b)    test_case(strcmp((a), (b)) op 0, "strcmp '%s' %s '%s'", a, #op, b)
 
#define test_mem(a, op, b, size)    test_case(memcmp((a), (b), (size)) op 0, "memcmp %p %s %p", a, #op, b)
 
#define test_warn(e)
 
#define test_error(e)
 
#define TEST_ENTRY(name)
 

Macro Definition Documentation

◆ TEST_ENTRY

#define TEST_ENTRY (   name)
Value:
static void name(void); \
main(int argc, char **argv) \
{ \
setvbuf(stdout, DPKG_NULL, _IOLBF, 0); \
\
TEST_MAIN_CTOR; \
name(); \
TEST_MAIN_DTOR; \
return 0; \
} \
static void \
name(void)
int main(int argc, const char *const *argv)
Definition: main.c:279
#define DPKG_NULL
A null pointer constant that works on C or C++.
Definition: macros.h:102

◆ TEST_MAIN_CTOR

#define TEST_MAIN_CTOR   push_error_context()

◆ TEST_MAIN_DTOR

#define TEST_MAIN_DTOR   pop_error_context(ehflag_normaltidy)