Blame src/check.h.in

Packit 0b5880
/*-*- mode:C; -*- */
Packit 0b5880
/*
Packit 0b5880
 * Check: a unit test framework for C
Packit 0b5880
 * Copyright (C) 2001, 2002 Arien Malec
Packit 0b5880
 *
Packit 0b5880
 * This library is free software; you can redistribute it and/or
Packit 0b5880
 * modify it under the terms of the GNU Lesser General Public
Packit 0b5880
 * License as published by the Free Software Foundation; either
Packit 0b5880
 * version 2.1 of the License, or (at your option) any later version.
Packit 0b5880
 *
Packit 0b5880
 * This library is distributed in the hope that it will be useful,
Packit 0b5880
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 0b5880
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 0b5880
 * Lesser General Public License for more details.
Packit 0b5880
 *
Packit 0b5880
 * You should have received a copy of the GNU Lesser General Public
Packit 0b5880
 * License along with this library; if not, write to the
Packit 0b5880
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
Packit 0b5880
 * MA 02110-1301, USA.
Packit 0b5880
 */
Packit 0b5880
Packit 0b5880
#ifndef CHECK_H
Packit 0b5880
#define CHECK_H
Packit 0b5880
Packit 0b5880
#include <stddef.h>
Packit 0b5880
#include <string.h>
Packit 0b5880
#include <math.h>
Packit 0b5880
#include <float.h>
Packit 0b5880
Packit 0b5880
#include <check_stdint.h>
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
   Macros and functions starting with _ (underscore) are internal and
Packit 0b5880
   may change without notice. You have been warned!.
Packit 0b5880
*/
Packit 0b5880
Packit 0b5880
Packit 0b5880
#ifdef __cplusplus
Packit 0b5880
#define CK_CPPSTART extern "C" {
Packit 0b5880
#define CK_CPPEND }
Packit 0b5880
CK_CPPSTART
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
#if defined(__GNUC__) && defined(__GNUC_MINOR__)
Packit 0b5880
#define GCC_VERSION_AT_LEAST(major, minor) \
Packit 0b5880
((__GNUC__ > (major)) || \
Packit 0b5880
 (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
Packit 0b5880
#else
Packit 0b5880
#define GCC_VERSION_AT_LEAST(major, minor) 0
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
#if GCC_VERSION_AT_LEAST(2,95)
Packit 0b5880
#define CK_ATTRIBUTE_UNUSED __attribute__ ((unused))
Packit 0b5880
#else
Packit 0b5880
#define CK_ATTRIBUTE_UNUSED
Packit 0b5880
#endif /* GCC 2.95 */
Packit 0b5880
Packit 0b5880
#if GCC_VERSION_AT_LEAST(2,5)
Packit 0b5880
#define CK_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
Packit 0b5880
#else
Packit 0b5880
#define CK_ATTRIBUTE_NORETURN
Packit 0b5880
#endif /* GCC 2.5 */
Packit 0b5880
Packit 0b5880
#include <sys/types.h>
Packit 0b5880
Packit 0b5880
#if defined(_MSC_VER)
Packit 0b5880
/* define pid_t for Windows, as it is needed later */
Packit 0b5880
#define pid_t int
Packit 0b5880
#endif /* _MSC_VER */
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * Used to create the linker script for hiding lib-local symbols. Shall
Packit 0b5880
 * be put directly in front of the exported symbol.
Packit 0b5880
 */
Packit 0b5880
#define CK_EXPORT
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * Used for MSVC to create the export attribute
Packit 0b5880
 * CK_DLL_EXP is defined during the compilation of the library
Packit 0b5880
 * on the command line.
Packit 0b5880
 */
Packit 0b5880
#ifndef CK_DLL_EXP
Packit 0b5880
#define CK_DLL_EXP
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
/* check version numbers */
Packit 0b5880
Packit 0b5880
#define CHECK_MAJOR_VERSION (@CHECK_MAJOR_VERSION@)
Packit 0b5880
#define CHECK_MINOR_VERSION (@CHECK_MINOR_VERSION@)
Packit 0b5880
#define CHECK_MICRO_VERSION (@CHECK_MICRO_VERSION@)
Packit 0b5880
Packit 0b5880
CK_DLL_EXP extern int CK_EXPORT check_major_version;
Packit 0b5880
CK_DLL_EXP extern int CK_EXPORT check_minor_version;
Packit 0b5880
CK_DLL_EXP extern int CK_EXPORT check_micro_version;
Packit 0b5880
Packit 0b5880
#ifndef NULL
Packit 0b5880
#define NULL ((void*)0)
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Type for a test case
Packit 0b5880
 *
Packit 0b5880
 * A TCase represents a test case.  Create with tcase_create, free
Packit 0b5880
 * with tcase_free.  For the moment, test cases can only be run
Packit 0b5880
 * through a suite
Packit 0b5880
*/
Packit 0b5880
typedef struct TCase TCase;
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Type for a test function
Packit 0b5880
 */
Packit 0b5880
typedef void (*TFun) (int);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Type for a setup/teardown function
Packit 0b5880
 */
Packit 0b5880
typedef void (*SFun) (void);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Type for a test suite
Packit 0b5880
 */
Packit 0b5880
typedef struct Suite Suite;
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Creates a test suite with the given name.
Packit 0b5880
 *
Packit 0b5880
 * Create a suite, which will contain test cases. Once
Packit 0b5880
 * created, use suite_add_tcase() to add test cases.
Packit 0b5880
 * When finished, create a suite runner from the
Packit 0b5880
 * suite using srunner_create()
Packit 0b5880
 *
Packit 0b5880
 * @param name name of the suite
Packit 0b5880
 *
Packit 0b5880
 * @return suite
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP Suite *CK_EXPORT suite_create(const char *name);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Determines whether a given test suite contains a case named after a
Packit 0b5880
 * given string.
Packit 0b5880
 *
Packit 0b5880
 * @param s suite to check
Packit 0b5880
 * @param tcname test case to look for
Packit 0b5880
 *
Packit 0b5880
 * @return 1 iff the given test case is within the given suite;
Packit 0b5880
 *          0 otherwise
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.9
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT suite_tcase(Suite * s, const char *tcname);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a test case to a suite.
Packit 0b5880
 *
Packit 0b5880
 * Note that if the TCase has already been added attempting
Packit 0b5880
 * to add it again will be ignored.
Packit 0b5880
 *
Packit 0b5880
 * @param s suite to add test case to
Packit 0b5880
 * @param tc test case to add to suite
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT suite_add_tcase(Suite * s, TCase * tc);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Create a test case.
Packit 0b5880
 *
Packit 0b5880
 * Once created, tests can be added with the tcase_add_test()
Packit 0b5880
 * function, and the test case assigned to a suite with the
Packit 0b5880
 * suite_add_tcase() function.
Packit 0b5880
 *
Packit 0b5880
 * @param name name of the test case
Packit 0b5880
 *
Packit 0b5880
 * @return test case containing no tests
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 * */
Packit 0b5880
CK_DLL_EXP TCase *CK_EXPORT tcase_create(const char *name);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Associate a test case with certain tags.
Packit 0b5880
 * Replaces any existing tags with the new set.
Packit 0b5880
 *
Packit 0b5880
 * @param tc the test case
Packit 0b5880
 *
Packit 0b5880
 * @param tags string containing arbitrary tags separated by spaces.
Packit 0b5880
 *        This will be copied. Passing NULL clears all tags.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 * */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT tcase_set_tags(TCase * tc,
Packit 0b5880
					 const char *tags);
Packit 0b5880
/**
Packit 0b5880
 * Add a test function to a test case
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf test function to add to test case
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 * */
Packit 0b5880
#define tcase_add_test(tc,tf) tcase_add_test_raise_signal(tc,tf,0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a test function with signal handling to a test case
Packit 0b5880
 *
Packit 0b5880
 * The added test is expected to terminate by throwing the given signal
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf test function to add to test case
Packit 0b5880
 * @param signal expected signal for test function to throw in order for
Packit 0b5880
 *                the test to be considered passing
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.2
Packit 0b5880
 * */
Packit 0b5880
#define tcase_add_test_raise_signal(tc,tf,signal) \
Packit 0b5880
   _tcase_add_test((tc),(tf),"" # tf "",(signal), 0, 0, 1)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a test function with an expected exit value to a test case
Packit 0b5880
 *
Packit 0b5880
 * The added test is expected to terminate by exiting with the given value
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf test function to add to test case
Packit 0b5880
 * @param expected_exit_value exit value for test function to return in
Packit 0b5880
 *                             order for the test to be considered passing
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.7
Packit 0b5880
 */
Packit 0b5880
#define tcase_add_exit_test(tc, tf, expected_exit_value) \
Packit 0b5880
  _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),0,1)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a looping test function to a test case
Packit 0b5880
 *
Packit 0b5880
 * The test will be called in a for(i = s; i < e; i++) loop with each
Packit 0b5880
 * iteration being executed in a new context. The loop variable 'i' is
Packit 0b5880
 * available in the test.
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf function to add to test case
Packit 0b5880
 * @param s starting index for value "i" in test
Packit 0b5880
 * @param e ending index for value "i" in test
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.4
Packit 0b5880
 */
Packit 0b5880
#define tcase_add_loop_test(tc,tf,s,e) \
Packit 0b5880
  _tcase_add_test((tc),(tf),"" # tf "",0,0,(s),(e))
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a looping test function with signal handling to a test case
Packit 0b5880
 *
Packit 0b5880
 * The test will be called in a for(i = s; i < e; i++) loop with each
Packit 0b5880
 * iteration being executed in a new context. The loop variable 'i' is
Packit 0b5880
 * available in the test.
Packit 0b5880
 *
Packit 0b5880
 * The added test is expected to terminate by throwing the given signal
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf function to add to test case
Packit 0b5880
 * @param signal expected signal for test function to throw in order for
Packit 0b5880
 *                the test to be considered passing
Packit 0b5880
 * @param s starting index for value "i" in test
Packit 0b5880
 * @param e ending index for value "i" in test
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.5
Packit 0b5880
 */
Packit 0b5880
#define tcase_add_loop_test_raise_signal(tc,tf,signal,s,e) \
Packit 0b5880
  _tcase_add_test((tc),(tf),"" # tf "",(signal),0,(s),(e))
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add a looping test function with an expected exit value to a test case
Packit 0b5880
 *
Packit 0b5880
 * The test will be called in a for(i = s; i < e; i++) loop with each
Packit 0b5880
 * iteration being executed in a new context. The loop variable 'i' is
Packit 0b5880
 * available in the test.
Packit 0b5880
 *
Packit 0b5880
 * The added test is expected to terminate by exiting with the given value
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add test to
Packit 0b5880
 * @param tf function to add to test case
Packit 0b5880
 * @param expected_exit_value exit value for test function to return in
Packit 0b5880
 *                             order for the test to be considered passing
Packit 0b5880
 * @param s starting index for value "i" in test
Packit 0b5880
 * @param e ending index for value "i" in test
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.7
Packit 0b5880
 */
Packit 0b5880
#define tcase_add_loop_exit_test(tc,tf,expected_exit_value,s,e) \
Packit 0b5880
  _tcase_add_test((tc),(tf),"" # tf "",0,(expected_exit_value),(s),(e))
Packit 0b5880
Packit 0b5880
/* Add a test function to a test case
Packit 0b5880
  (function version -- use this when the macro won't work
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP void CK_EXPORT _tcase_add_test(TCase * tc, TFun tf,
Packit 0b5880
                                          const char *fname, int _signal,
Packit 0b5880
                                          int allowed_exit_value, int start,
Packit 0b5880
                                          int end);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add unchecked fixture setup/teardown functions to a test case
Packit 0b5880
 *
Packit 0b5880
 * Unchecked fixture functions are run at the start and end of the
Packit 0b5880
 * test case, and not before and after unit tests. Further,
Packit 0b5880
 * unchecked fixture functions are not run in a separate address space,
Packit 0b5880
 * like test functions, and so must not exit or signal (e.g.,
Packit 0b5880
 * segfault).
Packit 0b5880
 *
Packit 0b5880
 * Also, when run in CK_NOFORK mode, unchecked fixture functions may
Packit 0b5880
 * lead to different unit test behavior if unit tests change data
Packit 0b5880
 * setup by the fixture functions.
Packit 0b5880
 *
Packit 0b5880
 * Note that if a setup function fails, the remaining setup functions
Packit 0b5880
 * will be omitted, as will the test case and the teardown functions.
Packit 0b5880
 * If a teardown function fails the remaining teardown functins will be
Packit 0b5880
 * omitted.
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add unchecked fixture setup/teardown to
Packit 0b5880
 * @param setup function to add to be executed before the test case;
Packit 0b5880
 *               if NULL no setup function is added
Packit 0b5880
 * @param teardown function to add to be executed after the test case;
Packit 0b5880
 *               if NULL no teardown function is added
Packit 0b5880
 * @since 0.8.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT tcase_add_unchecked_fixture(TCase * tc, SFun setup,
Packit 0b5880
                                                      SFun teardown);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add checked fixture setup/teardown functions to a test case
Packit 0b5880
 *
Packit 0b5880
 * Checked fixture functions are run before and after each unit test inside
Packit 0b5880
 * of the address space of the test. Thus, if using CK_FORK
Packit 0b5880
 * mode the separate process running the unit test will survive signals
Packit 0b5880
 * or unexpected exits in the fixture function. Also, if the setup
Packit 0b5880
 * function is idempotent, unit test behavior will be the same in
Packit 0b5880
 * CK_FORK and CK_NOFORK modes.
Packit 0b5880
 *
Packit 0b5880
 * However, since fixture functions are run before and after each unit
Packit 0b5880
 * test, they should not be expensive code.
Packit 0b5880
 *
Packit 0b5880
 * Note that if a setup function fails, the remaining setup functions
Packit 0b5880
 * will be omitted, as will the test and the teardown functions. If a
Packit 0b5880
 * teardown function fails the remaining teardown functins will be
Packit 0b5880
 * omitted.
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to add checked fixture setup/teardown to
Packit 0b5880
 * @param setup function to add to be executed before each unit test in
Packit 0b5880
 *               the test case;  if NULL no setup function is added
Packit 0b5880
 * @param teardown function to add to be executed after each unit test in
Packit 0b5880
 *               the test case; if NULL no teardown function is added
Packit 0b5880
 *
Packit 0b5880
 * @since 0.8.0
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP void CK_EXPORT tcase_add_checked_fixture(TCase * tc, SFun setup,
Packit 0b5880
                                                    SFun teardown);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the timeout for all tests in a test case.
Packit 0b5880
 *
Packit 0b5880
 * A test that lasts longer than the timeout (in seconds) will be killed
Packit 0b5880
 * and thus fail with an error.
Packit 0b5880
 *
Packit 0b5880
 * If not set, the default timeout is one assigned at compile time. If
Packit 0b5880
 * the environment variable CK_DEFAULT_TIMEOUT is defined and no timeout
Packit 0b5880
 * is set, the value in the environment variable is used.
Packit 0b5880
 *
Packit 0b5880
 * If Check is compile without fork() support this call is ignored,
Packit 0b5880
 * as timeouts are not possible.
Packit 0b5880
 *
Packit 0b5880
 * @param tc test case to assign timeout to
Packit 0b5880
 * @param timeout to use, in seconds. If the value contains a decimal
Packit 0b5880
 *                 portion, but no high resolution timer is available,
Packit 0b5880
 *                 the value is rounded up to the nearest second.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.2
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT tcase_set_timeout(TCase * tc, double timeout);
Packit 0b5880
Packit 0b5880
/* Internal function to mark the start of a test function */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT tcase_fn_start(const char *fname, const char *file,
Packit 0b5880
                                         int line);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retreive the name of the current running test. This is the name
Packit 0b5880
 * of the test passed to START_TEST. This is only valid when called
Packit 0b5880
 * from a running test. The value return outside of a running test is
Packit 0b5880
 * undefined.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char* CK_EXPORT tcase_name(void);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Start a unit test with START_TEST(unit_name), end with END_TEST.
Packit 0b5880
 *
Packit 0b5880
 * One must use braces within a START_/END_ pair to declare new variables
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
#define START_TEST(__testname)\
Packit 0b5880
static void __testname (int _i CK_ATTRIBUTE_UNUSED)\
Packit 0b5880
{\
Packit 0b5880
  tcase_fn_start (""# __testname, __FILE__, __LINE__);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 *  End a unit test
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
#define END_TEST }
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * Fail the test case unless expr is false
Packit 0b5880
 *
Packit 0b5880
 * This call is deprecated.
Packit 0b5880
 */
Packit 0b5880
#define fail_unless ck_assert_msg
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * Fail the test case if expr is false
Packit 0b5880
 *
Packit 0b5880
 * This call is deprecated.
Packit 0b5880
 *
Packit 0b5880
 * NOTE: The space before the comma sign before ## is essential to be compatible
Packit 0b5880
 * with gcc 2.95.3 and earlier.
Packit 0b5880
 * FIXME: these macros may conflict with C89 if expr is
Packit 0b5880
 * FIXME:   strcmp (str1, str2) due to excessive string length.
Packit 0b5880
 */
Packit 0b5880
#define fail_if(expr, ...)\
Packit 0b5880
  (expr) ? \
Packit 0b5880
     _ck_assert_failed(__FILE__, __LINE__, "Failure '"#expr"' occurred" , ## __VA_ARGS__, NULL) \
Packit 0b5880
     : _mark_point(__FILE__, __LINE__)
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * Fail the test
Packit 0b5880
 *
Packit 0b5880
 * This call is deprecated.
Packit 0b5880
 */
Packit 0b5880
#define fail ck_abort_msg
Packit 0b5880
Packit 0b5880
/*
Packit 0b5880
 * This is called whenever an assertion fails.
Packit 0b5880
 * Note that it only has the noreturn modifier when
Packit 0b5880
 * using fork. If fork is unavailable, the function
Packit 0b5880
 * calls longjmp() when a test assertion fails. Marking
Packit 0b5880
 * the function as noreturn causes gcc to make assumptions
Packit 0b5880
 * which are not valid, as longjmp() is like a return.
Packit 0b5880
 */
Packit 0b5880
#if @HAVE_FORK@
Packit 0b5880
CK_DLL_EXP void CK_EXPORT _ck_assert_failed(const char *file, int line,
Packit 0b5880
                                            const char *expr,
Packit 0b5880
                                            ...) CK_ATTRIBUTE_NORETURN;
Packit 0b5880
#else
Packit 0b5880
CK_DLL_EXP void CK_EXPORT _ck_assert_failed(const char *file, int line,
Packit 0b5880
                                            const char *expr, ...);
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Fail the test if expression is false
Packit 0b5880
 *
Packit 0b5880
 * @param expr expression to evaluate
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert(expr) ck_assert_msg(expr, NULL)
Packit 0b5880
Packit 0b5880
/* The space before the comma sign before ## is essential to be compatible
Packit 0b5880
   with gcc 2.95.3 and earlier.
Packit 0b5880
*/
Packit 0b5880
/**
Packit 0b5880
 * Fail the test if the expression is false; print message on failure
Packit 0b5880
 *
Packit 0b5880
 * @param expr expression to evaluate
Packit 0b5880
 * @param ... message to print (in printf format) if expression is false
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_msg(expr, ...) \
Packit 0b5880
  (expr) ? \
Packit 0b5880
     _mark_point(__FILE__, __LINE__) : \
Packit 0b5880
     _ck_assert_failed(__FILE__, __LINE__, "Assertion '"#expr"' failed" , ## __VA_ARGS__, NULL)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Unconditionally fail the test
Packit 0b5880
 *
Packit 0b5880
 * @note Once called, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_abort() ck_abort_msg(NULL)
Packit 0b5880
/**
Packit 0b5880
 * Unconditionally fail the test; print a message
Packit 0b5880
 *
Packit 0b5880
 * @param ... message to print (in printf format)
Packit 0b5880
 *
Packit 0b5880
 * @note Once called, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_abort_msg(...) _ck_assert_failed(__FILE__, __LINE__, "Failed" , ## __VA_ARGS__, NULL)
Packit 0b5880
Packit 0b5880
/* Signed and unsigned integer comparison macros with improved output compared to ck_assert(). */
Packit 0b5880
/* OP may be any comparison operator. */
Packit 0b5880
#define _ck_assert_int(X, OP, Y) do { \
Packit 0b5880
  intmax_t _ck_x = (X); \
Packit 0b5880
  intmax_t _ck_y = (Y); \
Packit 0b5880
  ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s == %jd, %s == %jd", #X" "#OP" "#Y, #X, _ck_x, #Y, _ck_y); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X==Y
Packit 0b5880
 *
Packit 0b5880
 * If not X==Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_eq(X, Y) _ck_assert_int(X, ==, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X!=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X!=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_ne(X, Y) _ck_assert_int(X, !=, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X
Packit 0b5880
 *
Packit 0b5880
 * If not X
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_lt(X, Y) _ck_assert_int(X, <, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X<=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X<=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_le(X, Y) _ck_assert_int(X, <=, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X>Y
Packit 0b5880
 *
Packit 0b5880
 * If not X>Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_gt(X, Y) _ck_assert_int(X, >, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two signed integers to determine if X>=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X>=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_int_ge(X, Y) _ck_assert_int(X, >=, Y)
Packit 0b5880
Packit 0b5880
#define _ck_assert_uint(X, OP, Y) do { \
Packit 0b5880
  uintmax_t _ck_x = (X); \
Packit 0b5880
  uintmax_t _ck_y = (Y); \
Packit 0b5880
  ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s == %ju, %s == %ju", #X" "#OP" "#Y, #X, _ck_x, #Y, _ck_y); \
Packit 0b5880
} while (0)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X==Y
Packit 0b5880
 *
Packit 0b5880
 * If not X==Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_eq(X, Y) _ck_assert_uint(X, ==, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X!=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X!=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_ne(X, Y) _ck_assert_uint(X, !=, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X
Packit 0b5880
 *
Packit 0b5880
 * If not X
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_lt(X, Y) _ck_assert_uint(X, <, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X<=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X<=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_le(X, Y) _ck_assert_uint(X, <=, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X>Y
Packit 0b5880
 *
Packit 0b5880
 * If not X>Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_gt(X, Y) _ck_assert_uint(X, >, Y)
Packit 0b5880
/**
Packit 0b5880
 * Check two unsigned integers to determine if X>=Y
Packit 0b5880
 *
Packit 0b5880
 * If not X>=Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X signed integer
Packit 0b5880
 * @param Y signed integer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_uint_ge(X, Y) _ck_assert_uint(X, >=, Y)
Packit 0b5880
Packit 0b5880
/* Number of digits after the decimal point to output via printf */
Packit 0b5880
#ifndef CK_FLOATING_DIG
Packit 0b5880
# define CK_FLOATING_DIG 6
Packit 0b5880
#endif /* CK_FLOATING_DIG */
Packit 0b5880
Packit 0b5880
/* Floating point number comparison macros with improved output
Packit 0b5880
 * compared to ck_assert(). */
Packit 0b5880
/* OP may be any comparison operator, TP is type, TM is type modifier. */
Packit 0b5880
#define _ck_assert_floating(X, OP, Y, TP, TM) do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  TP _ck_y = (Y); \
Packit 0b5880
  ck_assert_msg(_ck_x OP _ck_y, \
Packit 0b5880
  "Assertion '%s' failed: %s == %.*" TM "g, %s == %.*" TM "g", \
Packit 0b5880
  #X" "#OP" "#Y, \
Packit 0b5880
  #X, (int)CK_FLOATING_DIG, _ck_x, \
Packit 0b5880
  #Y, (int)CK_FLOATING_DIG, _ck_y); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Check floating point number is finise. */
Packit 0b5880
/* TP is type, TM is type modifier. */
Packit 0b5880
#define _ck_assert_floating_finite(X, TP, TM) \
Packit 0b5880
do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  ck_assert_msg(isfinite(_ck_x), \
Packit 0b5880
    "Assertion '%s' failed: %s == %.*" TM "g", \
Packit 0b5880
    #X" is finite", \
Packit 0b5880
    #X, (int)CK_FLOATING_DIG, _ck_x); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Check floating point number is infinise. */
Packit 0b5880
/* TP is type, TM is type modifier. */
Packit 0b5880
#define _ck_assert_floating_infinite(X, TP, TM) \
Packit 0b5880
do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  ck_assert_msg(isinf(_ck_x), \
Packit 0b5880
    "Assertion '%s' failed: %s == %.*" TM "g", \
Packit 0b5880
    #X" is infinite", \
Packit 0b5880
    #X, (int)CK_FLOATING_DIG, _ck_x); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Check floating point number is "Not a Number". */
Packit 0b5880
/* TP is type, TM is type modifier. */
Packit 0b5880
#define _ck_assert_floating_nan(X, TP, TM) \
Packit 0b5880
do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  ck_assert_msg(isnan(_ck_x), \
Packit 0b5880
    "Assertion '%s' failed: %s == %.*" TM "g", \
Packit 0b5880
    #X" is NaN", \
Packit 0b5880
    #X, (int)CK_FLOATING_DIG, _ck_x); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Check floating point number is not "Not a Number". */
Packit 0b5880
/* TP is type, TM is type modifier. */
Packit 0b5880
#define _ck_assert_floating_nonnan(X, TP, TM) \
Packit 0b5880
do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  ck_assert_msg(!isnan(_ck_x), \
Packit 0b5880
    "Assertion '%s' failed: %s == %.*" TM "g", \
Packit 0b5880
    #X" is not NaN", \
Packit 0b5880
    #X, (int)CK_FLOATING_DIG, _ck_x); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Floating point tolerance comparison macros with improved output
Packit 0b5880
 * compared to ck_assert(). */
Packit 0b5880
/* OP, D can have values: >, -1; <, 1. */
Packit 0b5880
#define _ck_assert_floating_op_tol(X, OP, Y, T, D, TP, TM) do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  TP _ck_y = (Y); \
Packit 0b5880
  TP _ck_t = (T); \
Packit 0b5880
  ck_assert_msg((_ck_x - _ck_y) OP _ck_t * (D), \
Packit 0b5880
  "Assertion '%s' failed: %s == %.*" TM "g, %s == %.*" TM "g, %s == %.*" TM "g", \
Packit 0b5880
  #X" "#OP"= "#Y", error < "#T, \
Packit 0b5880
  #X, (int)CK_FLOATING_DIG, _ck_x, \
Packit 0b5880
  #Y, (int)CK_FLOATING_DIG, _ck_y, \
Packit 0b5880
  #T, (int)CK_FLOATING_DIG, _ck_t); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Floating point tolerance comparison macros with improved output
Packit 0b5880
 * compared to ck_assert(). */
Packit 0b5880
/* OP can have values: <; >=. */
Packit 0b5880
#define _ck_assert_floating_absdiff_op_tol(X, Y, OP, T, TP, TM) \
Packit 0b5880
do { \
Packit 0b5880
  TP _ck_x = (X); \
Packit 0b5880
  TP _ck_y = (Y); \
Packit 0b5880
  TP _ck_t = (T); \
Packit 0b5880
  ck_assert_msg(fabsl(_ck_y - _ck_x) OP _ck_t, \
Packit 0b5880
    "Assertion '%s' failed: %s == %.*" TM "g, %s == %.*" TM "g, %s == %.*" TM "g", \
Packit 0b5880
    "fabsl("#Y" - "#X") "#OP" "#T, \
Packit 0b5880
    #X, (int)CK_FLOATING_DIG, _ck_x, \
Packit 0b5880
    #Y, (int)CK_FLOATING_DIG, _ck_y, \
Packit 0b5880
    #T, (int)CK_FLOATING_DIG, _ck_t); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X == Y
Packit 0b5880
 *
Packit 0b5880
 * If not X == Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_eq(X, Y) _ck_assert_floating(X, ==, Y, float, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X != Y
Packit 0b5880
 *
Packit 0b5880
 * If not X != Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_ne(X, Y) _ck_assert_floating(X, !=, Y, float, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X < Y
Packit 0b5880
 *
Packit 0b5880
 * If not X < Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_lt(X, Y) _ck_assert_floating(X, <, Y, float, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X <= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X <= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_le(X, Y) _ck_assert_floating(X, <=, Y, float, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X > Y
Packit 0b5880
 *
Packit 0b5880
 * If not X > Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_gt(X, Y) _ck_assert_floating(X, >, Y, float, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X >= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X >= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_ge(X, Y) _ck_assert_floating(X, >=, Y, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 * @param T tolerance (float)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_eq_tol(X, Y, T)  _ck_assert_floating_absdiff_op_tol(X, Y, <, T, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if not X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 * @param T tolerance (float)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_ne_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, >=, T, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X>≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X >≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 * @param T tolerance (float)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_ge_tol(X, Y, T) _ck_assert_floating_op_tol(X, >, Y, T, -1, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two single precision floating point numbers to determine if X<≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X <≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float)
Packit 0b5880
 * @param Y floating point number (float) to compare against X
Packit 0b5880
 * @param T tolerance (float)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_le_tol(X, Y, T) _ck_assert_floating_op_tol(X, <, Y, T, 1, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a single precision floating point number is finite; i.e. is
Packit 0b5880
 * not +infinity, -infinity, or "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is +INFINITY or X is -INFINITY, or X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_finite(X) _ck_assert_floating_finite(X, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a single precision floating point number is infinite,
Packit 0b5880
 * either +infinity or -infinity
Packit 0b5880
 *
Packit 0b5880
 * If X is not +INFINITY and X is not -INFINITY, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_infinite(X) _ck_assert_floating_infinite(X, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a single precision floating point number
Packit 0b5880
 * is "Not a Number" (NaN)
Packit 0b5880
 *  
Packit 0b5880
 * If X is not NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_nan(X) _ck_assert_floating_nan(X, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a single precision floating point number is
Packit 0b5880
 * not "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (float) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_float_nonnan(X) _ck_assert_floating_nonnan(X, float, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X == Y
Packit 0b5880
 *
Packit 0b5880
 * If not X == Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_eq(X, Y) _ck_assert_floating(X, ==, Y, double, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X != Y
Packit 0b5880
 *
Packit 0b5880
 * If not X != Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_ne(X, Y) _ck_assert_floating(X, !=, Y, double, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X < Y
Packit 0b5880
 *
Packit 0b5880
 * If not X < Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_lt(X, Y) _ck_assert_floating(X, <, Y, double, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X <= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X <= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_le(X, Y) _ck_assert_floating(X, <=, Y, double, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X > Y
Packit 0b5880
 *
Packit 0b5880
 * If not X > Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_gt(X, Y) _ck_assert_floating(X, >, Y, double, "")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X >= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X >= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_ge(X, Y) _ck_assert_floating(X, >=, Y, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 * @param T tolerance (double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_eq_tol(X, Y, T)  _ck_assert_floating_absdiff_op_tol(X, Y, <, T, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if not X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 * @param T tolerance (double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_ne_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, >=, T, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X>≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X >≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 * @param T tolerance (double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_ge_tol(X, Y, T) _ck_assert_floating_op_tol(X, >, Y, T, -1, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X<≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X <≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double)
Packit 0b5880
 * @param Y floating point number (double) to compare against X
Packit 0b5880
 * @param T tolerance (double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_le_tol(X, Y, T) _ck_assert_floating_op_tol(X, <, Y, T, 1, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is finite; i.e. is
Packit 0b5880
 * not +infinity, -infinity, or "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is +INFINITY or X is -INFINITY, or X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_finite(X) _ck_assert_floating_finite(X, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is infinite,
Packit 0b5880
 * either +infinity or -infinity
Packit 0b5880
 *
Packit 0b5880
 * If X is not +INFINITY and X is not -INFINITY, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_infinite(X) _ck_assert_floating_infinite(X, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number
Packit 0b5880
 * is "Not a Number" (NaN)
Packit 0b5880
 *  
Packit 0b5880
 * If X is not NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_nan(X) _ck_assert_floating_nan(X, double, "")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is
Packit 0b5880
 * not "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_double_nonnan(X) _ck_assert_floating_nonnan(X, double, "")
Packit 0b5880
Packit 0b5880
/** 
Packit 0b5880
 * Check two double precision floating point numbers to determine if X == Y
Packit 0b5880
 *
Packit 0b5880
 * If not X == Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_eq(X, Y) _ck_assert_floating(X, ==, Y, long double, "L")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X != Y
Packit 0b5880
 *
Packit 0b5880
 * If not X != Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_ne(X, Y) _ck_assert_floating(X, !=, Y, long double, "L")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X < Y
Packit 0b5880
 *
Packit 0b5880
 * If not X < Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_lt(X, Y) _ck_assert_floating(X, <, Y, long double, "L")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X <= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X <= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_le(X, Y) _ck_assert_floating(X, <=, Y, long double, "L")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X > Y
Packit 0b5880
 *
Packit 0b5880
 * If not X > Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_gt(X, Y) _ck_assert_floating(X, >, Y, long double, "L")
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X >= Y
Packit 0b5880
 *
Packit 0b5880
 * If not X >= Y, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_ge(X, Y) _ck_assert_floating(X, >=, Y, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 * @param T tolerance (long double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_eq_tol(X, Y, T)  _ck_assert_floating_absdiff_op_tol(X, Y, <, T, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if not X≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If X ≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 * @param T tolerance (long double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_ne_tol(X, Y, T) _ck_assert_floating_absdiff_op_tol(X, Y, >=, T, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X>≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X >≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 * @param T tolerance (long double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_ge_tol(X, Y, T) _ck_assert_floating_op_tol(X, >, Y, T, -1, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two double precision floating point numbers to determine if X<≈Y
Packit 0b5880
 * with specified tolerance
Packit 0b5880
 *
Packit 0b5880
 * If not X <≈ Y with error < T, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double)
Packit 0b5880
 * @param Y floating point number (long double) to compare against X
Packit 0b5880
 * @param T tolerance (long double)
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_le_tol(X, Y, T) _ck_assert_floating_op_tol(X, <, Y, T, 1, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is finite; i.e. is
Packit 0b5880
 * not +infinity, -infinity, or "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is +INFINITY or X is -INFINITY, or X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_finite(X) _ck_assert_floating_finite(X, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is infinite,
Packit 0b5880
 * either +infinity or -infinity
Packit 0b5880
 *
Packit 0b5880
 * If X is not +INFINITY and X is not -INFINITY, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_infinite(X) _ck_assert_floating_infinite(X, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number
Packit 0b5880
 * is "Not a Number" (NaN)
Packit 0b5880
 *  
Packit 0b5880
 * If X is not NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_nan(X) _ck_assert_floating_nan(X, long double, "L")
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check that a double precision floating point number is
Packit 0b5880
 * not "Not a Number" (NaN)
Packit 0b5880
 *
Packit 0b5880
 * If X is NaN, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X floating point number (long double) to be checked
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ldouble_nonnan(X) _ck_assert_floating_nonnan(X, long double, "L")
Packit 0b5880
Packit 0b5880
/* String comparison macros with improved output compared to ck_assert() */
Packit 0b5880
/* OP might be any operator that can be used in '0 OP strcmp(X,Y)' comparison. */
Packit 0b5880
/* String pointer could be compared againts NULL with == (NULLEQ = 1) and != (NULLNE = 1) operators. */
Packit 0b5880
/* The x and y parameter swap in strcmp() is needed to handle >, >=, <, <= operators. */
Packit 0b5880
/* If the x or y parameter is NULL its value will be printed without quotes. */
Packit 0b5880
#define _ck_assert_str(X, OP, Y, NULLEQ, NULLNE) do { \
Packit 0b5880
  const char* _ck_x = (X); \
Packit 0b5880
  const char* _ck_y = (Y); \
Packit 0b5880
  const char* _ck_x_s; \
Packit 0b5880
  const char* _ck_y_s; \
Packit 0b5880
  const char* _ck_x_q; \
Packit 0b5880
  const char* _ck_y_q; \
Packit 0b5880
  if (_ck_x != NULL) { \
Packit 0b5880
    _ck_x_q = "\""; \
Packit 0b5880
    _ck_x_s = _ck_x; \
Packit 0b5880
  } else { \
Packit 0b5880
    _ck_x_q = ""; \
Packit 0b5880
    _ck_x_s = "(null)"; \
Packit 0b5880
  } \
Packit 0b5880
  if (_ck_y != NULL) { \
Packit 0b5880
    _ck_y_q = "\""; \
Packit 0b5880
    _ck_y_s = _ck_y; \
Packit 0b5880
  } else { \
Packit 0b5880
    _ck_y_q = ""; \
Packit 0b5880
    _ck_y_s = "(null)"; \
Packit 0b5880
  } \
Packit 0b5880
  ck_assert_msg( \
Packit 0b5880
    (NULLEQ && (_ck_x == NULL) && (_ck_y == NULL)) || \
Packit 0b5880
    (NULLNE && ((_ck_x == NULL) || (_ck_y == NULL)) && (_ck_x != _ck_y)) || \
Packit 0b5880
    ((_ck_x != NULL) && (_ck_y != NULL) && (0 OP strcmp(_ck_y, _ck_x))), \
Packit 0b5880
    "Assertion '%s' failed: %s == %s%s%s, %s == %s%s%s", \
Packit 0b5880
    #X" "#OP" "#Y, \
Packit 0b5880
    #X, _ck_x_q, _ck_x_s, _ck_x_q, \
Packit 0b5880
    #Y, _ck_y_q, _ck_y_s, _ck_y_q); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0==strcmp(X,Y)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test failes.
Packit 0b5880
 * If (0==strcmp(X,Y)), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_eq(X, Y) _ck_assert_str(X, ==, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0!=strcmp(X,Y)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test fails.
Packit 0b5880
 * If not 0!=strcmp(X,Y), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.6
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_ne(X, Y) _ck_assert_str(X, !=, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0<strcmp(X,Y), (e.g. strcmp(X,Y)>0)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test fails.
Packit 0b5880
 * If not 0
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_lt(X, Y) _ck_assert_str(X, <, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0<=strcmp(X,Y) (e.g. strcmp(X,Y)>=0)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test fails.
Packit 0b5880
 * If not 0<=strcmp(X,Y), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_le(X, Y) _ck_assert_str(X, <=, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0<strcmp(X,Y) (e.g. strcmp(X,Y)>0)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test fails.
Packit 0b5880
 * If not 0
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_gt(X, Y) _ck_assert_str(X, >, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0>=strcmp(X,Y) (e.g. strcmp(X,Y)<=0)
Packit 0b5880
 *
Packit 0b5880
 * If X or Y is NULL the test fails.
Packit 0b5880
 * If not 0>=strcmp(X,Y), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_str_ge(X, Y) _ck_assert_str(X, >=, Y, 0, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0==strcmp(X,Y) or if both are undefined 
Packit 0b5880
 *
Packit 0b5880
 * If both X and Y are NULL the test passes. However, if only one is NULL
Packit 0b5880
 * the test fails.
Packit 0b5880
 * If not ((X==NULL)&&(Y==NULL)) || (0==strcmp(X,Y)), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_pstr_eq(X, Y) _ck_assert_str(X, ==, Y, 1, 0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check two strings to determine if 0!=strcmp(X,Y) or one of them is undefined
Packit 0b5880
 *
Packit 0b5880
 * If either X or Y is NULL the test passes, however if both are NULL
Packit 0b5880
 * the test fails.
Packit 0b5880
 * If not (X!=NULL)&&(Y!=NULL)&&(0!=strcmp(X,Y)), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X string
Packit 0b5880
 * @param Y string to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_pstr_ne(X, Y) _ck_assert_str(X, !=, Y, 0, 1)
Packit 0b5880
Packit 0b5880
/* Memory location comparison macros with improved output compared to ck_assert() */
Packit 0b5880
/* OP might be any operator that can be used in '0 OP memcmp(X,Y,L)' comparison */
Packit 0b5880
/* The x and y parameter swap in memcmp() is needed to handle >, >=, <, <= operators */
Packit 0b5880
/* Output is limited to CK_MAX_ASSERT_MEM_PRINT_SIZE bytes */
Packit 0b5880
#ifndef CK_MAX_ASSERT_MEM_PRINT_SIZE
Packit 0b5880
#define CK_MAX_ASSERT_MEM_PRINT_SIZE 64
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
/* Memory location comparison macros with improved output compared to ck_assert() */
Packit 0b5880
/* OP might be any operator that can be used in '0 OP memcmp(X,Y,L)' comparison */
Packit 0b5880
/* The x and y parameter swap in memcmp() is needed to handle >, >=, <, <= operators */
Packit 0b5880
/* Output is limited to CK_MAX_ASSERT_MEM_PRINT_SIZE bytes */
Packit 0b5880
#ifndef CK_MAX_ASSERT_MEM_PRINT_SIZE
Packit 0b5880
#define CK_MAX_ASSERT_MEM_PRINT_SIZE 64
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
#define _ck_assert_mem(X, OP, Y, L) do { \
Packit 0b5880
  const uint8_t* _ck_x = (const uint8_t*)(X); \
Packit 0b5880
  const uint8_t* _ck_y = (const uint8_t*)(Y); \
Packit 0b5880
  size_t _ck_l = (L); \
Packit 0b5880
  char _ck_x_str[CK_MAX_ASSERT_MEM_PRINT_SIZE * 2 + 1]; \
Packit 0b5880
  char _ck_y_str[CK_MAX_ASSERT_MEM_PRINT_SIZE * 2 + 1]; \
Packit 0b5880
  static const char _ck_hexdigits[] = "0123456789abcdef"; \
Packit 0b5880
  size_t _ck_i; \
Packit 0b5880
  size_t _ck_maxl = (_ck_l > CK_MAX_ASSERT_MEM_PRINT_SIZE) ? CK_MAX_ASSERT_MEM_PRINT_SIZE : _ck_l; \
Packit 0b5880
  for (_ck_i = 0; _ck_i < _ck_maxl; _ck_i++) { \
Packit 0b5880
    _ck_x_str[_ck_i * 2  ]   = _ck_hexdigits[(_ck_x[_ck_i] >> 4) & 0xF]; \
Packit 0b5880
    _ck_y_str[_ck_i * 2  ]   = _ck_hexdigits[(_ck_y[_ck_i] >> 4) & 0xF]; \
Packit 0b5880
    _ck_x_str[_ck_i * 2 + 1] = _ck_hexdigits[_ck_x[_ck_i] & 0xF]; \
Packit 0b5880
    _ck_y_str[_ck_i * 2 + 1] = _ck_hexdigits[_ck_y[_ck_i] & 0xF]; \
Packit 0b5880
  } \
Packit 0b5880
  _ck_x_str[_ck_i * 2] = 0; \
Packit 0b5880
  _ck_y_str[_ck_i * 2] = 0; \
Packit 0b5880
  if (_ck_maxl != _ck_l) { \
Packit 0b5880
    _ck_x_str[_ck_i * 2 - 2] = '.'; \
Packit 0b5880
    _ck_y_str[_ck_i * 2 - 2] = '.'; \
Packit 0b5880
    _ck_x_str[_ck_i * 2 - 1] = '.'; \
Packit 0b5880
    _ck_y_str[_ck_i * 2 - 1] = '.'; \
Packit 0b5880
  } \
Packit 0b5880
  ck_assert_msg(0 OP memcmp(_ck_y, _ck_x, _ck_l), \
Packit 0b5880
    "Assertion '%s' failed: %s == \"%s\", %s == \"%s\"", #X" "#OP" "#Y, #X, _ck_x_str, #Y, _ck_y_str); \
Packit 0b5880
} while (0)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0==memcmp(X,Y,L)
Packit 0b5880
 *
Packit 0b5880
 * If not 0==memcmp(X,Y,L), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_eq(X, Y, L) _ck_assert_mem(X, ==, Y, L)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0!=memcmp(X,Y,L)
Packit 0b5880
 *
Packit 0b5880
 * If not 0!=memcmp(X,Y,L), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_ne(X, Y, L) _ck_assert_mem(X, !=, Y, L)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0<memcmp(X,Y,L), (e.g. memcmp(X,Y,L)>0)
Packit 0b5880
 *
Packit 0b5880
 * If not 0
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_lt(X, Y, L) _ck_assert_mem(X, <, Y, L)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0<=memcmp(X,Y,L) (e.g. memcmp(X,Y,L)>=0)
Packit 0b5880
 *
Packit 0b5880
 * If not 0<=memcmp(X,Y,L), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_le(X, Y, L) _ck_assert_mem(X, <=, Y, L)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0<memcmp(X,Y,L) (e.g. memcmp(X,Y,L)>0)
Packit 0b5880
 *
Packit 0b5880
 * If not 0
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_gt(X, Y, L) _ck_assert_mem(X, >, Y, L)
Packit 0b5880
/**
Packit 0b5880
 * Check two memory locations to determine if 0>=memcmp(X,Y,L) (e.g. memcmp(X,Y,L)<=0)
Packit 0b5880
 *
Packit 0b5880
 * If not 0>=memcmp(X,Y,L), the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X memory location
Packit 0b5880
 * @param Y memory location to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_mem_ge(X, Y, L) _ck_assert_mem(X, >=, Y, L)
Packit 0b5880
Packit 0b5880
/* Pointer comparison macros with improved output compared to ck_assert(). */
Packit 0b5880
/* OP may only be == or !=  */
Packit 0b5880
#define _ck_assert_ptr(X, OP, Y) do { \
Packit 0b5880
  const void* _ck_x = (X); \
Packit 0b5880
  const void* _ck_y = (Y); \
Packit 0b5880
  ck_assert_msg(_ck_x OP _ck_y, "Assertion '%s' failed: %s == %#x, %s == %#x", #X" "#OP" "#Y, #X, _ck_x, #Y, _ck_y); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/* Pointer against NULL comparison macros with improved output
Packit 0b5880
 * compared to ck_assert(). */
Packit 0b5880
/* OP may only be == or !=  */
Packit 0b5880
#define _ck_assert_ptr_null(X, OP) do { \
Packit 0b5880
  const void* _ck_x = (X); \
Packit 0b5880
  ck_assert_msg(_ck_x OP NULL, \
Packit 0b5880
  "Assertion '%s' failed: %s == %#x", \
Packit 0b5880
  #X" "#OP" NULL", \
Packit 0b5880
  #X, _ck_x); \
Packit 0b5880
} while (0)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check if two pointers are equal.
Packit 0b5880
 *
Packit 0b5880
 * If the two passed pointers are not equal, the test
Packit 0b5880
 * fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X pointer
Packit 0b5880
 * @param Y pointer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ptr_eq(X, Y) _ck_assert_ptr(X, ==, Y)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check if two pointers are not.
Packit 0b5880
 *
Packit 0b5880
 * If the two passed pointers are equal, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X pointer
Packit 0b5880
 * @param Y pointer to compare against X
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.10
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ptr_ne(X, Y) _ck_assert_ptr(X, !=, Y)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check if a pointer is equal to NULL.
Packit 0b5880
 *
Packit 0b5880
 * If X != NULL, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X pointer to compare against NULL
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ptr_null(X) _ck_assert_ptr_null(X, ==)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Check if a pointer is not equal to NULL.
Packit 0b5880
 *
Packit 0b5880
 * If X == NULL, the test fails.
Packit 0b5880
 *
Packit 0b5880
 * @param X pointer to compare against NULL
Packit 0b5880
 *
Packit 0b5880
 * @note If the check fails, the remaining of the test is aborted
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
#define ck_assert_ptr_nonnull(X) _ck_assert_ptr_null(X, !=)
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Mark the last point reached in a unit test.
Packit 0b5880
 *
Packit 0b5880
 * If the test throws a signal or exits, the location noted with the
Packit 0b5880
 * failure is the last location of a ck_assert*() or ck_abort() call.
Packit 0b5880
 * Use mark_point() to record intermediate locations (useful for tracking down
Packit 0b5880
 * crashes or exits).
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
*/
Packit 0b5880
#define mark_point() _mark_point(__FILE__,__LINE__)
Packit 0b5880
Packit 0b5880
/* Non macro version of #mark_point */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT _mark_point(const char *file, int line);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Enum describing the possible results of a test
Packit 0b5880
 */
Packit 0b5880
enum test_result
Packit 0b5880
{
Packit 0b5880
    CK_TEST_RESULT_INVALID,     /**< Default value; should not encounter this */
Packit 0b5880
    CK_PASS,                    /**< Test passed */
Packit 0b5880
    CK_FAILURE,                 /**< Test completed but failed */
Packit 0b5880
    CK_ERROR                    /**< Test failed to complete
Packit 0b5880
                                   (unexpected signal or non-zero early exit) */
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Enum specifying the verbosity of output a SRunner should produce
Packit 0b5880
 */
Packit 0b5880
enum print_output
Packit 0b5880
{
Packit 0b5880
    CK_SILENT,                  /**< No output */
Packit 0b5880
    CK_MINIMAL,                 /**< Only summary output */
Packit 0b5880
    CK_NORMAL,                  /**< All failed tests */
Packit 0b5880
    CK_VERBOSE,                 /**< All tests */
Packit 0b5880
    CK_ENV,                     /**< Look at environment var CK_VERBOSITY
Packit 0b5880
                                     for what verbosity to use, which can be
Packit 0b5880
                                     either "silent", "minimal", "normal",
Packit 0b5880
                                     or "verbose". If the environment variable
Packit 0b5880
                                     is not set, then CK_NORMAL will be used.*/
Packit 0b5880
#if @ENABLE_SUBUNIT@
Packit 0b5880
    CK_SUBUNIT,                 /**< Run as a subunit child process */
Packit 0b5880
#endif
Packit 0b5880
    CK_LAST                     /**< Not a valid option */
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Holds state for a running of a test suite
Packit 0b5880
 */
Packit 0b5880
typedef struct SRunner SRunner;
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Opaque type for a test failure
Packit 0b5880
 */
Packit 0b5880
typedef struct TestResult TestResult;
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Enum representing the types of contexts for a test
Packit 0b5880
 */
Packit 0b5880
enum ck_result_ctx
Packit 0b5880
{
Packit 0b5880
    CK_CTX_INVALID,             /**< Default value; should not encounter this */
Packit 0b5880
    CK_CTX_SETUP,               /**< Setup before a test */
Packit 0b5880
    CK_CTX_TEST,                /**< Body of test itself */
Packit 0b5880
    CK_CTX_TEARDOWN             /**< Teardown after a test */
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve type of result that the given test result represents.
Packit 0b5880
 *
Packit 0b5880
 * This is a member of test_result, and can represent a
Packit 0b5880
 * pass, failure, or error.
Packit 0b5880
 *
Packit 0b5880
 * @param tr test result to retrieve result from
Packit 0b5880
 *
Packit 0b5880
 * @return result of given test
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT tr_rtype(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve context in which the result occurred for the given test result.
Packit 0b5880
 *
Packit 0b5880
 * The types of contents include the test setup, teardown, or the
Packit 0b5880
 * body of the test itself.
Packit 0b5880
 *
Packit 0b5880
 * @param tr test result to retrieve context from
Packit 0b5880
 *
Packit 0b5880
 * @return context to which the given test result applies
Packit 0b5880
 *
Packit 0b5880
 * @since 0.8.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP enum ck_result_ctx CK_EXPORT tr_ctx(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve failure message from test result, if applicable.
Packit 0b5880
 *
Packit 0b5880
 * @return pointer to a message, if one exists. NULL otherwise.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT tr_msg(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve line number at which a failure occurred, if applicable.
Packit 0b5880
 *
Packit 0b5880
 * @return If the test resulted in a failure, returns the line number
Packit 0b5880
 *          that the failure occurred on; otherwise returns -1.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT tr_lno(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve file name at which a failure occurred, if applicable.
Packit 0b5880
 *
Packit 0b5880
 * @return If the test resulted in a failure, returns a string
Packit 0b5880
 *          containing the name of the file where the failure
Packit 0b5880
 *          occurred; otherwise returns NULL.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT tr_lfile(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve test case name in which a failure occurred, if applicable.
Packit 0b5880
 *
Packit 0b5880
 * @return If the test resulted in a failure, returns a string
Packit 0b5880
 *          containing the name of the test suite where the failure
Packit 0b5880
 *          occurred; otherwise returns NULL.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT tr_tcname(TestResult * tr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Creates a suite runner for the given suite.
Packit 0b5880
 *
Packit 0b5880
 * Once created, additional suites can be added to the
Packit 0b5880
 * suite runner using srunner_add_suite(), and the suite runner can be
Packit 0b5880
 * run with srunner_run_all(). Once finished, the suite runner
Packit 0b5880
 * must be freed with srunner_free().
Packit 0b5880
 *
Packit 0b5880
 * @param s suite to generate a suite runner for
Packit 0b5880
 *
Packit 0b5880
 * @return suite runner for the given suite
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP SRunner *CK_EXPORT srunner_create(Suite * s);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Add an additional suite to a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * The first suite in a suite runner is always added in srunner_create().
Packit 0b5880
 * This call adds additional suites to a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to add the given suite
Packit 0b5880
 * @param s suite to add to the given suite runner
Packit 0b5880
 *
Packit 0b5880
 * @since 0.7.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_add_suite(SRunner * sr, Suite * s);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Frees a suite runner, including all contained suite and test cases.
Packit 0b5880
 *
Packit 0b5880
 * This call is responsible for freeing all resources related to a
Packit 0b5880
 * suite runner and all contained suites and test cases. Suite and
Packit 0b5880
 * test cases need not be freed individually, as this call handles that.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to free
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_free(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Runs a suite runner and all contained suite, printing results to
Packit 0b5880
 * stdout as specified by the print_mode.
Packit 0b5880
 *
Packit 0b5880
 * In addition to running all suites, if the suite runner has been
Packit 0b5880
 * configured to output to a log, that is also performed.
Packit 0b5880
 *
Packit 0b5880
 * Note that if the CK_RUN_CASE, CK_RUN_SUITE, CK_INCLUDE_TAGS and/or
Packit 0b5880
 * CK_EXCLUDE_TAGS environment variables are defined, then only the
Packit 0b5880
 * named suites or test cases will run.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to run all suites from
Packit 0b5880
 * @param print_mode the verbosity in which to report results to stdout
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_run_all(SRunner * sr,
Packit 0b5880
                                          enum print_output print_mode);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Run a specific suite or test case from a suite runner, printing results
Packit 0b5880
 * to stdout as specified by the print_mode.
Packit 0b5880
 *
Packit 0b5880
 * In addition to running any applicable suites or test cases, if the
Packit 0b5880
 * suite runner has been configured to output to a log, that is also
Packit 0b5880
 * performed.
Packit 0b5880
 *
Packit 0b5880
 * Note that if the sname and tcname parameters are passed as null
Packit 0b5880
 * then the function will fallback to using the environment variables
Packit 0b5880
 * CK_RUN_SUITE and CK_RUN_CASE respectively in order to select the
Packit 0b5880
 * suite/cases.
Packit 0b5880
 * 
Packit 0b5880
 * Similarly if the CK_INCLUDE_TAGS and/or CK_EXCLUDE_TAGS environment
Packit 0b5880
 * variables are defined then these will further filter the test cases
Packit 0b5880
 * (see srunner_run_tagged, below).
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner where the given suite or test case must be
Packit 0b5880
 * @param sname suite name to run. A NULL means use the value of the
Packit 0b5880
 * environment variable CK_RUN_SUITE if set, otherwise run "any/every
Packit 0b5880
 * suite".
Packit 0b5880
 * @param tcname test case name to run. A NULL means use the value of
Packit 0b5880
 * the environment variable CK_RUN_CASE if set, otherwise run
Packit 0b5880
 * "any/every case".
Packit 0b5880
 * @param print_mode the verbosity in which to report results to stdout
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.9
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_run(SRunner * sr, const char *sname,
Packit 0b5880
                                      const char *tcname,
Packit 0b5880
                                      enum print_output print_mode);
Packit 0b5880
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Run a specific suite or test case or testcases with specific tags
Packit 0b5880
 * from a suite runner, printing results to stdout as specified by the
Packit 0b5880
 * print_mode.
Packit 0b5880
 *
Packit 0b5880
 * In addition to running any applicable suites or test cases, if the
Packit 0b5880
 * suite runner has been configured to output to a log, that is also
Packit 0b5880
 * performed.
Packit 0b5880
 *
Packit 0b5880
 * Note that if sname, tcname, include_tags, exclude_tags parameters
Packit 0b5880
 * are passed as NULL then if the environment variables CK_RUN_SUITE,
Packit 0b5880
 * CK_RUN_CASE, CK_INCLUDE_TAGS, CK_EXCLUDE_TAGS are defined then these
Packit 0b5880
 * values will be used instead.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner where the given suite or test case must be
Packit 0b5880
 * @param sname suite name to run. A NULL means use the value of the
Packit 0b5880
 * environment variable CK_RUN_SUITE if set, otherwise run "any/every
Packit 0b5880
 * suite".
Packit 0b5880
 * @param tcname test case name to run. A NULL means use the value of
Packit 0b5880
 * the environment variable CK_RUN_CASE if set, otherwise run
Packit 0b5880
 * "any/every case".
Packit 0b5880
 * @param include_tags space separate list of tags. Only run test
Packit 0b5880
 * cases that share one of these tags. A NULL means use the value of
Packit 0b5880
 * the environment variable CK_INCLUDE_TAGS if set, otherwise run
Packit 0b5880
 * "any/every test case".
Packit 0b5880
 * @param exclude_tags space separate list of tags. Only run test
Packit 0b5880
 * cases that do not share one of these tags even if they are selected
Packit 0b5880
 * by an included tag. A NULL means use the value of the environment
Packit 0b5880
 * variable CK_EXCLUDE_TAGS if set, otherwise run "any/every test
Packit 0b5880
 * case".
Packit 0b5880
 * @param print_mode the verbosity in which to report results to stdout
Packit 0b5880
 *
Packit 0b5880
 * @since 0.11.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_run_tagged(SRunner * sr, const char *sname,
Packit 0b5880
					     const char *tcname,
Packit 0b5880
					     const char *include_tags,
Packit 0b5880
					     const char *exclude_tags,
Packit 0b5880
					     enum print_output print_mode);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve the number of failed tests executed by a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * This value represents both test failures and errors.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to query for all failed tests
Packit 0b5880
 *
Packit 0b5880
 * @return number of test failures and errors found by the suite runner
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT srunner_ntests_failed(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve the total number of tests run by a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to query for all tests run
Packit 0b5880
 *
Packit 0b5880
 * @return number of all tests run by the suite runner
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT srunner_ntests_run(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Return an array of results for all failures found by a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * Number of results is equal to srunner_nfailed_tests().
Packit 0b5880
 *
Packit 0b5880
 * Information about individual results can be queried using:
Packit 0b5880
 * tr_rtype(), tr_ctx(), tr_msg(), tr_lno(), tr_lfile(), and tr_tcname().
Packit 0b5880
 *
Packit 0b5880
 * Memory is malloc'ed and must be freed; however free the entire structure
Packit 0b5880
 * instead of individual test cases.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to retrieve results from
Packit 0b5880
 *
Packit 0b5880
 * @return array of TestResult objects
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP TestResult **CK_EXPORT srunner_failures(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Return an array of results for all tests run by a suite runner.
Packit 0b5880
 *
Packit 0b5880
 * Number of results is equal to srunner_ntests_run(), and excludes
Packit 0b5880
 * failures due to setup function failure.
Packit 0b5880
 *
Packit 0b5880
 * Information about individual results can be queried using:
Packit 0b5880
 * tr_rtype(), tr_ctx(), tr_msg(), tr_lno(), tr_lfile(), and tr_tcname().
Packit 0b5880
 *
Packit 0b5880
 * Memory is malloc'ed and must be freed; however free the entire structure
Packit 0b5880
 * instead of individual test cases.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to retrieve results from
Packit 0b5880
 *
Packit 0b5880
 * @return array of TestResult objects
Packit 0b5880
 *
Packit 0b5880
 * @since 0.6.1
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP TestResult **CK_EXPORT srunner_results(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Print the results contained in an SRunner to stdout.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to print results for to stdout
Packit 0b5880
 * @param print_mode the print_output (verbosity) to use to report
Packit 0b5880
 *         the result
Packit 0b5880
 *
Packit 0b5880
 * @since 0.7.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_print(SRunner * sr,
Packit 0b5880
                                        enum print_output print_mode);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the suite runner to output the result in log format to the
Packit 0b5880
 * given file.
Packit 0b5880
 *
Packit 0b5880
 * Note: log file setting is an initialize only operation -- it should
Packit 0b5880
 * be done immediately after SRunner creation, and the log file can't be
Packit 0b5880
 * changed after being set.
Packit 0b5880
 *
Packit 0b5880
 * This setting does not conflict with the other log output types;
Packit 0b5880
 * all logging types can occur concurrently if configured.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to log results of in log format
Packit 0b5880
 * @param fname file name to output log results to
Packit 0b5880
 *
Packit 0b5880
 * @since 0.7.1
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_set_log(SRunner * sr, const char *fname);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Checks if the suite runner is assigned a file for log output.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to check
Packit 0b5880
 *
Packit 0b5880
 * @return 1 iff the suite runner currently is configured to output
Packit 0b5880
 *         in log format; 0 otherwise
Packit 0b5880
 *
Packit 0b5880
 * @since 0.7.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT srunner_has_log(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieves the name of the currently assigned file
Packit 0b5880
 * for log output, if any exists.
Packit 0b5880
 *
Packit 0b5880
 * @return the name of the log file, or NULL if none is configured
Packit 0b5880
 *
Packit 0b5880
 * @since 0.7.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT srunner_log_fname(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the suite runner to output the result in XML format to the
Packit 0b5880
 * given file.
Packit 0b5880
 *
Packit 0b5880
 * Note: XML file setting is an initialize only operation -- it should
Packit 0b5880
 * be done immediately after SRunner creation, and the XML file can't be
Packit 0b5880
 * changed after being set.
Packit 0b5880
 *
Packit 0b5880
 * This setting does not conflict with the other log output types;
Packit 0b5880
 * all logging types can occur concurrently if configured.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to log results of in XML format
Packit 0b5880
 * @param fname file name to output XML results to
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.1
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_set_xml(SRunner * sr, const char *fname);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Checks if the suite runner is assigned a file for XML output.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to check
Packit 0b5880
 *
Packit 0b5880
 * @return 1 iff the suite runner currently is configured to output
Packit 0b5880
 *         in XML format; 0 otherwise
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT srunner_has_xml(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieves the name of the currently assigned file
Packit 0b5880
 * for XML output, if any exists.
Packit 0b5880
 *
Packit 0b5880
 * @return the name of the XML file, or NULL if none is configured
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.1
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT srunner_xml_fname(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the suite runner to output the result in TAP format to the
Packit 0b5880
 * given file.
Packit 0b5880
 *
Packit 0b5880
 * Note: TAP file setting is an initialize only operation -- it should
Packit 0b5880
 * be done immediately after SRunner creation, and the TAP file can't be
Packit 0b5880
 * changed after being set.
Packit 0b5880
 *
Packit 0b5880
 * This setting does not conflict with the other log output types;
Packit 0b5880
 * all logging types can occur concurrently if configured.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to log results of in TAP format
Packit 0b5880
 * @param fname file name to output TAP results to
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.12
Packit 0b5880
*/
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_set_tap(SRunner * sr, const char *fname);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Checks if the suite runner is assigned a file for TAP output.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to check
Packit 0b5880
 *
Packit 0b5880
 * @return 1 iff the suite runner currently is configured to output
Packit 0b5880
 *         in TAP format; 0 otherwise
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.12
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP int CK_EXPORT srunner_has_tap(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieves the name of the currently assigned file
Packit 0b5880
 * for TAP output, if any exists.
Packit 0b5880
 *
Packit 0b5880
 * @return the name of the TAP file, or NULL if none is configured
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.12
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP const char *CK_EXPORT srunner_tap_fname(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Enum describing the current fork usage.
Packit 0b5880
 */
Packit 0b5880
enum fork_status
Packit 0b5880
{
Packit 0b5880
    CK_FORK_GETENV,             /**< look in the environment for CK_FORK */
Packit 0b5880
    CK_FORK,                    /**< call fork to run tests */
Packit 0b5880
    CK_NOFORK                   /**< don't call fork */
Packit 0b5880
};
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Retrieve the current fork status for the given suite runner
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to check fork status of
Packit 0b5880
 *
Packit 0b5880
 * @since 0.8.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP enum fork_status CK_EXPORT srunner_fork_status(SRunner * sr);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the fork status for a given suite runner.
Packit 0b5880
 *
Packit 0b5880
 * The default fork status is CK_FORK_GETENV, which will look
Packit 0b5880
 * for the CK_FORK environment variable, which can be set to
Packit 0b5880
 * "yes" or "no". If the environment variable is not present,
Packit 0b5880
 * CK_FORK will be used if fork() is available on the system,
Packit 0b5880
 * otherwise CK_NOFORK is used.
Packit 0b5880
 *
Packit 0b5880
 * If set to CK_FORK or CK_NOFORK, the environment variable
Packit 0b5880
 * if defined is ignored.
Packit 0b5880
 *
Packit 0b5880
 * If Check is compiled without support for fork(), attempting
Packit 0b5880
 * to set the status to CK_FORK is ignored.
Packit 0b5880
 *
Packit 0b5880
 * @param sr suite runner to assign the fork status to
Packit 0b5880
 * @param fstat fork status to assign
Packit 0b5880
 *
Packit 0b5880
 * @since 0.8.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT srunner_set_fork_status(SRunner * sr,
Packit 0b5880
                                                  enum fork_status fstat);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Invoke fork() during a test and assign the child to the same
Packit 0b5880
 * process group that the rest of the test case uses.
Packit 0b5880
 *
Packit 0b5880
 * One can invoke fork() directly during a test; however doing so
Packit 0b5880
 * may not guarantee that any children processes are destroyed once
Packit 0b5880
 * the test finishes. Once a test has completed, all processes in
Packit 0b5880
 * the process group will be killed; using this wrapper will prevent
Packit 0b5880
 * orphan processes.
Packit 0b5880
 *
Packit 0b5880
 * If Check is compiled without fork() support this call simply
Packit 0b5880
 * return -1 and does nothing.
Packit 0b5880
 *
Packit 0b5880
 * @return On success, the PID of the child process is returned in
Packit 0b5880
 *          the parent, and 0 is returned in the child.  On failure,
Packit 0b5880
 *          a value of -1 is returned to the parent process and no
Packit 0b5880
 *          child process is created.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.3
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP pid_t CK_EXPORT check_fork(void);
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Wait for the pid and exit.
Packit 0b5880
 *
Packit 0b5880
 * This is to be used in conjunction with check_fork(). When called,
Packit 0b5880
 * will wait for the given process to terminate. If the process
Packit 0b5880
 * exited without error, exit(EXIT_SUCCESS) is invoked; otherwise
Packit 0b5880
 * exit(EXIT_FAILURE) is invoked.
Packit 0b5880
 *
Packit 0b5880
 * If Check is compiled without support for fork(), this invokes
Packit 0b5880
 * exit(EXIT_FAILURE).
Packit 0b5880
 *
Packit 0b5880
 * @param pid process to wait for, created by check_fork()
Packit 0b5880
 *
Packit 0b5880
 * @since 0.9.3
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT check_waitpid_and_exit(pid_t pid) CK_ATTRIBUTE_NORETURN;
Packit 0b5880
Packit 0b5880
/**
Packit 0b5880
 * Set the maximal assertion message size.
Packit 0b5880
 *
Packit 0b5880
 * This protects the code against unintentional extremely large assertion messages
Packit 0b5880
 * (values of up to 4GB were seen in the wild).
Packit 0b5880
 * The usual size for a message is less than 80 bytes.
Packit 0b5880
 *
Packit 0b5880
 * If the environment variable CK_MAX_MSG_SIZE is defined to a positive value, it is used.
Packit 0b5880
 * Otherwise, if a positive maximal message size is set via this function, it is used.
Packit 0b5880
 * Otherwise, the maximal message size is one assigned at compile time (4K bytes).
Packit 0b5880
 *
Packit 0b5880
 * @param max_msg_size the maximal assertion message size.
Packit 0b5880
 *
Packit 0b5880
 * @since 0.12.0
Packit 0b5880
 */
Packit 0b5880
CK_DLL_EXP void CK_EXPORT check_set_max_msg_size(size_t max_msg_size);
Packit 0b5880
Packit 0b5880
#ifdef __cplusplus
Packit 0b5880
CK_CPPEND
Packit 0b5880
#endif
Packit 0b5880
Packit 0b5880
#endif /* CHECK_H */