YAZ 5.37.0
test.c File Reference

Unit Test for YAZ. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <yaz/test.h>
#include <yaz/log.h>
#include <yaz/snprintf.h>

Go to the source code of this file.

Functions

static FILE * get_file (void)
static const char * progname (const char *argv0)
void yaz_check_init1 (int *argc_p, char ***argv_p)
 used by macro. Should not be called directly
void yaz_check_init_log (const char *argv0)
 Initialize the log system.
void yaz_check_inc_todo (void)
 used by macro. Should not be called directly
void yaz_check_term1 (void)
 used by macro. Should not be called directly
void yaz_check_eq1 (int type, const char *file, int line, const char *left, const char *right, int lval, int rval)
 used by macro. Should not be called directly
void yaz_check_print1 (int type, const char *file, int line, const char *expr)
 used by macro. Should not be called directly
int yaz_test_get_verbosity ()
 Get the verbosity level.

Variables

static FILE * test_fout = 0
static int test_total = 0
static int test_failed = 0
static int test_todo = 0
static int test_verbose = 1
static const char * test_prog = 0
static int log_tests = 0
static int test_stop = 0

Detailed Description

Unit Test for YAZ.

Definition in file test.c.

Function Documentation

◆ get_file()

FILE * get_file ( void )
static

Definition at line 34 of file test.c.

References test_fout.

Referenced by yaz_check_print1(), and yaz_check_term1().

◆ progname()

const char * progname ( const char * argv0)
static

Definition at line 41 of file test.c.

◆ yaz_check_eq1()

void yaz_check_eq1 ( int type,
const char * file,
int line,
const char * left,
const char * right,
int lval,
int rval )

used by macro. Should not be called directly

Definition at line 168 of file test.c.

References type, yaz_check_print1(), yaz_snprintf(), and YAZ_TEST_TYPE_OK.

◆ yaz_check_inc_todo()

void yaz_check_inc_todo ( void )

used by macro. Should not be called directly

Definition at line 128 of file test.c.

References test_todo.

◆ yaz_check_init1()

void yaz_check_init1 ( int * argc_p,
char *** argv_p )

used by macro. Should not be called directly

Definition at line 52 of file test.c.

References progname, test_fout, test_prog, test_stop, and test_verbose.

◆ yaz_check_init_log()

void yaz_check_init_log ( const char * argv0)

Initialize the log system.

used by macro. Should not be called directly

Definition at line 118 of file test.c.

References log_tests, progname, yaz_log_init_file(), yaz_log_trunc(), and yaz_snprintf().

◆ yaz_check_print1()

void yaz_check_print1 ( int type,
const char * file,
int line,
const char * expr )

used by macro. Should not be called directly

Definition at line 180 of file test.c.

References get_file(), log_tests, test_failed, test_stop, test_total, test_verbose, type, yaz_log(), YAZ_TEST_TYPE_FAIL, YAZ_TEST_TYPE_OK, and YLOG_LOG.

Referenced by yaz_check_eq1().

◆ yaz_check_term1()

void yaz_check_term1 ( void )

used by macro. Should not be called directly

Definition at line 133 of file test.c.

References get_file(), test_failed, test_fout, test_prog, test_todo, test_total, test_verbose, and yaz_deinit_globals().

◆ yaz_test_get_verbosity()

int yaz_test_get_verbosity ( void )

Get the verbosity level.

Definition at line 218 of file test.c.

References test_verbose.

Variable Documentation

◆ log_tests

int log_tests = 0
static

Definition at line 31 of file test.c.

Referenced by yaz_check_init_log(), and yaz_check_print1().

◆ test_failed

int test_failed = 0
static

Definition at line 27 of file test.c.

Referenced by yaz_check_print1(), and yaz_check_term1().

◆ test_fout

FILE* test_fout = 0
static

Definition at line 25 of file test.c.

Referenced by get_file(), yaz_check_init1(), and yaz_check_term1().

◆ test_prog

const char* test_prog = 0
static

Definition at line 30 of file test.c.

Referenced by yaz_check_init1(), and yaz_check_term1().

◆ test_stop

int test_stop = 0
static

Definition at line 32 of file test.c.

Referenced by yaz_check_init1(), and yaz_check_print1().

◆ test_todo

int test_todo = 0
static

Definition at line 28 of file test.c.

Referenced by yaz_check_inc_todo(), and yaz_check_term1().

◆ test_total

int test_total = 0
static

Definition at line 26 of file test.c.

Referenced by yaz_check_print1(), and yaz_check_term1().

◆ test_verbose

int test_verbose = 1
static

Definition at line 29 of file test.c.

Referenced by yaz_check_init1(), yaz_check_print1(), yaz_check_term1(), and yaz_test_get_verbosity().