netatalk  4.6.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
test.h File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atalk/cnid.h>
#include <atalk/directory.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/queue.h>
#include <atalk/util.h>
#include <atalk/volume.h>
#include "afp_config.h"
#include "dircache.h"
#include "directory.h"
#include "hash.h"
#include "subtests.h"
#include "volume.h"

Go to the source code of this file.

Macros

#define TEST_SKIP   77
#define TEST(a, desc)
#define TEST_int(a, b, desc)
#define TEST_expr(a, b, desc)
#define TEST_int_or_skip(a, b, desc)

Functions

static FILE * test_stream (void)
static void alignok (int len)
static void test_plan (int count)
static void test_section (const char *title, const char *underline)
static void test_begin (const char *name)
static void test_ok (const char *name)
static void test_fail (const char *name, const char *file, int line)
static void test_fail_int (const char *name, int got, int expected, const char *file, int line)
static void test_abort (void)
static void test_skip (const char *name)

Variables

int test_output_tap
int test_case_num
FILE * test_report_stream

Macro Definition Documentation

◆ TEST

#define TEST ( a,
desc )
Value:
do { \
test_begin(desc); \
a; \
test_ok(desc); \
} while (0)

◆ TEST_expr

#define TEST_expr ( a,
b,
desc )
Value:
do { \
test_begin(desc); \
a; \
if (b) { \
test_ok(desc); \
} else { \
test_fail(desc, __FILE__, __LINE__); \
test_abort(); \
exit(1); \
} \
} while (0)

◆ TEST_int

#define TEST_int ( a,
b,
desc )
Value:
do { \
test_begin(desc); \
if ((reti = (a)) != b) { \
test_fail_int(desc, reti, b, __FILE__, \
__LINE__); \
test_abort(); \
exit(1); \
} else { \
test_ok(desc); \
} \
} while (0)

◆ TEST_int_or_skip

#define TEST_int_or_skip ( a,
b,
desc )
Value:
do { \
test_begin(desc); \
reti = (a); \
if (reti == TEST_SKIP) { \
test_skip(desc); \
} else if (reti != b) { \
test_fail_int(desc, reti, b, __FILE__, \
__LINE__); \
test_abort(); \
exit(1); \
} else { \
test_ok(desc); \
} \
} while (0)
#define TEST_SKIP
Definition test.h:137

Like TEST_int, but a TEST_SKIP return marks the test skipped (not failed), for tests that cannot run on the current platform or build configuration.

◆ TEST_SKIP

#define TEST_SKIP   77

Sentinel return value: a test could not run on this platform/build and is skipped (not a failure). Mirrors the conventional autotools/meson skip exit code; surfaced as a TAP "ok N - name # SKIP" directive.

Function Documentation

◆ alignok()

void alignok ( int len)
inlinestatic

◆ test_abort()

void test_abort ( void )
inlinestatic

◆ test_begin()

void test_begin ( const char * name)
inlinestatic

◆ test_fail()

void test_fail ( const char * name,
const char * file,
int line )
inlinestatic

◆ test_fail_int()

void test_fail_int ( const char * name,
int got,
int expected,
const char * file,
int line )
inlinestatic

◆ test_ok()

void test_ok ( const char * name)
inlinestatic

◆ test_plan()

void test_plan ( int count)
inlinestatic

◆ test_section()

void test_section ( const char * title,
const char * underline )
inlinestatic

◆ test_skip()

void test_skip ( const char * name)
inlinestatic

◆ test_stream()

FILE * test_stream ( void )
inlinestatic

Variable Documentation

◆ test_case_num

int test_case_num
extern

◆ test_output_tap

int test_output_tap
extern

◆ test_report_stream

FILE* test_report_stream
extern