CCL: /home/chisarie/Documents/lsst_ccl/CCL/tests/ctest.h File Reference

CCL

Data Structures | Macros | Typedefs | Functions
ctest.h File Reference
`#include <inttypes.h>`
`#include <stddef.h>`
`#include <setjmp.h>`
`#include <stdarg.h>`
`#include <stdio.h>`
`#include <string.h>`
`#include <sys/time.h>`
`#include <unistd.h>`
`#include <stdint.h>`
`#include <stdlib.h>`

Go to the source code of this file.

## Data Structures
struct | ctest

## Macros
#define | WEAK __attribute__ ((weak))
#define | __FNAME(sname, tname) __ctest_##sname##_##tname##_run
#define | __TNAME(sname, tname) __ctest_##sname##_##tname
#define | __CTEST_MAGIC (0xdeadbeef)
#define | __Test_Section __attribute__ ((used, section (".ctest")))
#define | __CTEST_STRUCT(sname, tname, _skip, __data, __setup, __teardown)
#define | CTEST_DATA(sname) struct sname##_data
#define | CTEST_SETUP(sname) void WEAK sname##_setup(struct sname##_data* data)
#define | CTEST_TEARDOWN(sname) void WEAK sname##_teardown(struct sname##_data* data)
#define | __CTEST_INTERNAL(sname, tname, _skip)
#define | SETUP_FNAME(sname) sname##_setup
#define | TEARDOWN_FNAME(sname) sname##_teardown
#define | __CTEST2_INTERNAL(sname, tname, _skip)
#define | CTEST(sname, tname) __CTEST_INTERNAL(sname, tname, 0)
#define | CTEST_SKIP(sname, tname) __CTEST_INTERNAL(sname, tname, 1)
#define | CTEST2(sname, tname) __CTEST2_INTERNAL(sname, tname, 0)
#define | CTEST2_SKIP(sname, tname) __CTEST2_INTERNAL(sname, tname, 1)
#define | ASSERT_STR(exp, real) assert_str(exp, real, __FILE__, __LINE__)
#define | ASSERT_DATA(exp, expsize, real, realsize) assert_data(exp, expsize, real, realsize, __FILE__, __LINE__)
#define | ASSERT_EQUAL(exp, real) assert_equal(exp, real, __FILE__, __LINE__)
#define | ASSERT_EQUAL_U(exp, real) assert_equal_u(exp, real, __FILE__, __LINE__)
#define | ASSERT_NOT_EQUAL(exp, real) assert_not_equal(exp, real, __FILE__, __LINE__)
#define | ASSERT_NOT_EQUAL_U(exp, real) assert_not_equal_u(exp, real, __FILE__, __LINE__)
#define | ASSERT_INTERVAL(exp1, exp2, real) assert_interval(exp1, exp2, real, __FILE__, __LINE__)
#define | ASSERT_NULL(real) assert_null((void*)real, __FILE__, __LINE__)
#define | ASSERT_NOT_NULL(real) assert_not_null(real, __FILE__, __LINE__)
#define | ASSERT_TRUE(real) assert_true(real, __FILE__, __LINE__)
#define | ASSERT_FALSE(real) assert_false(real, __FILE__, __LINE__)
#define | ASSERT_FAIL() assert_fail(__FILE__, __LINE__)
#define | ASSERT_DBL_NEAR(exp, real) assert_dbl_near(exp, real, 1e-4, __FILE__, __LINE__)
#define | ASSERT_DBL_NEAR_TOL(exp, real, tol) assert_dbl_near(exp, real, tol, __FILE__, __LINE__)
#define | ASSERT_DBL_FAR(exp, real) assert_dbl_far(exp, real, 1e-4, __FILE__, __LINE__)
#define | ASSERT_DBL_FAR_TOL(exp, real, tol) assert_dbl_far(exp, real, tol, __FILE__, __LINE__)

## Typedefs
typedef void(* | SetupFunc) (void *)
typedef void(* | TearDownFunc) (void *)

## Functions
void | CTEST_LOG (const char *fmt,...)
void | CTEST_ERR (const char *fmt,...)
void | assert_str (const char *exp, const char *real, const char *caller, int line)
void | assert_data (const unsigned char *exp, size_t expsize, const unsigned char *real, size_t realsize, const char *caller, int line)
void | assert_equal (intmax_t exp, intmax_t real, const char *caller, int line)
void | assert_equal_u (uintmax_t exp, uintmax_t real, const char *caller, int line)
void | assert_not_equal (intmax_t exp, intmax_t real, const char *caller, int line)
void | assert_not_equal_u (uintmax_t exp, uintmax_t real, const char *caller, int line)
void | assert_interval (intmax_t exp1, intmax_t exp2, intmax_t real, const char *caller, int line)
void | assert_null (void *real, const char *caller, int line)
void | assert_not_null (const void *real, const char *caller, int line)
void | assert_true (int real, const char *caller, int line)
void | assert_false (int real, const char *caller, int line)
void | assert_fail (const char *caller, int line)
void | assert_dbl_near (double exp, double real, double tol, const char *caller, int line)
void | assert_dbl_far (double exp, double real, double tol, const char *caller, int line)

## Macro Definition Documentation

## ◆ __CTEST2_INTERNAL

#define __CTEST2_INTERNAL | ( |  | sname,
|  |  | tname,
|  |  | _skip
| ) |  |

Value:
static struct sname##_data __ctest_##sname##_data; \
CTEST_SETUP(sname); \
CTEST_TEARDOWN(sname); \
void __FNAME(sname, tname)(struct sname##_data* data); \
__CTEST_STRUCT(sname, tname, _skip, &__ctest_##sname##_data, SETUP_FNAME(sname), TEARDOWN_FNAME(sname)) \
void __FNAME(sname, tname)(struct sname##_data* data)
SETUP_FNAME
#define SETUP_FNAME(sname)
Definition: ctest.h:88
TEARDOWN_FNAME
#define TEARDOWN_FNAME(sname)
Definition: ctest.h:89
__FNAME
#define __FNAME(sname, tname)
Definition: ctest.h:50

## ◆ __CTEST_INTERNAL

#define __CTEST_INTERNAL | ( |  | sname,
|  |  | tname,
|  |  | _skip
| ) |  |

Value:
void __FNAME(sname, tname)(); \
__CTEST_STRUCT(sname, tname, _skip, NULL, NULL, NULL) \
void __FNAME(sname, tname)()
__FNAME
#define __FNAME(sname, tname)
Definition: ctest.h:50

## ◆ __CTEST_MAGIC

#define __CTEST_MAGIC (0xdeadbeef)

## ◆ __CTEST_STRUCT

#define __CTEST_STRUCT | ( |  | sname,
|  |  | tname,
|  |  | _skip,
|  |  | __data,
|  |  | __setup,
|  |  | __teardown
| ) |  |

Value:
static struct ctest __TNAME(sname, tname) __Test_Section = { \
.ssname=#sname, \
.ttname=#tname, \
.run = __FNAME(sname, tname), \
.skip = _skip, \
.data = __data, \
.setup = (SetupFunc)__setup, \
.teardown = (TearDownFunc)__teardown, \
.magic = __CTEST_MAGIC };
__Test_Section
#define __Test_Section
Definition: ctest.h:57
__TNAME
#define __TNAME(sname, tname)
Definition: ctest.h:51
TearDownFunc
void(* TearDownFunc)(void *)
Definition: ctest.h:35
ctest
Definition: ctest.h:37
ctest::teardown
TearDownFunc teardown
Definition: ctest.h:45
__CTEST_MAGIC
#define __CTEST_MAGIC
Definition: ctest.h:53
SetupFunc
void(* SetupFunc)(void *)
Definition: ctest.h:34
__FNAME
#define __FNAME(sname, tname)
Definition: ctest.h:50

## ◆ __FNAME

#define __FNAME | ( |  | sname,
|  |  | tname
| ) |  | __ctest_##sname##_##tname##_run

## ◆ __Test_Section

#define __Test_Section __attribute__ ((used, section (".ctest")))

## ◆ __TNAME

#define __TNAME | ( |  | sname,
|  |  | tname
| ) |  | __ctest_##sname##_##tname

## ◆ ASSERT_DATA

#define ASSERT_DATA | ( |  | exp,
|  |  | expsize,
|  |  | real,
|  |  | realsize
| ) |  | assert_data(exp, expsize, real, realsize, __FILE__, __LINE__)

## ◆ ASSERT_DBL_FAR

#define ASSERT_DBL_FAR | ( |  | exp,
|  |  | real
| ) |  | assert_dbl_far(exp, real, 1e-4, __FILE__, __LINE__)

## ◆ ASSERT_DBL_FAR_TOL

#define ASSERT_DBL_FAR_TOL | ( |  | exp,
|  |  | real,
|  |  | tol
| ) |  | assert_dbl_far(exp, real, tol, __FILE__, __LINE__)

## ◆ ASSERT_DBL_NEAR

#define ASSERT_DBL_NEAR | ( |  | exp,
|  |  | real
| ) |  | assert_dbl_near(exp, real, 1e-4, __FILE__, __LINE__)

## ◆ ASSERT_DBL_NEAR_TOL

#define ASSERT_DBL_NEAR_TOL | ( |  | exp,
|  |  | real,
|  |  | tol
| ) |  | assert_dbl_near(exp, real, tol, __FILE__, __LINE__)

## ◆ ASSERT_EQUAL

#define ASSERT_EQUAL | ( |  | exp,
|  |  | real
| ) |  | assert_equal(exp, real, __FILE__, __LINE__)

## ◆ ASSERT_EQUAL_U

#define ASSERT_EQUAL_U | ( |  | exp,
|  |  | real
| ) |  | assert_equal_u(exp, real, __FILE__, __LINE__)

## ◆ ASSERT_FAIL

#define ASSERT_FAIL | ( |  | ) | assert_fail(__FILE__, __LINE__)

## ◆ ASSERT_FALSE

#define ASSERT_FALSE | ( |  | real | ) | assert_false(real, __FILE__, __LINE__)

## ◆ ASSERT_INTERVAL

#define ASSERT_INTERVAL | ( |  | exp1,
|  |  | exp2,
|  |  | real
| ) |  | assert_interval(exp1, exp2, real, __FILE__, __LINE__)

## ◆ ASSERT_NOT_EQUAL

#define ASSERT_NOT_EQUAL | ( |  | exp,
|  |  | real
| ) |  | assert_not_equal(exp, real, __FILE__, __LINE__)

## ◆ ASSERT_NOT_EQUAL_U

#define ASSERT_NOT_EQUAL_U | ( |  | exp,
|  |  | real
| ) |  | assert_not_equal_u(exp, real, __FILE__, __LINE__)

## ◆ ASSERT_NOT_NULL

#define ASSERT_NOT_NULL | ( |  | real | ) | assert_not_null(real, __FILE__, __LINE__)

## ◆ ASSERT_NULL

#define ASSERT_NULL | ( |  | real | ) | assert_null((void*)real, __FILE__, __LINE__)

## ◆ ASSERT_STR

#define ASSERT_STR | ( |  | exp,
|  |  | real
| ) |  | assert_str(exp, real, __FILE__, __LINE__)

## ◆ ASSERT_TRUE

#define ASSERT_TRUE | ( |  | real | ) | assert_true(real, __FILE__, __LINE__)

## ◆ CTEST

#define CTEST | ( |  | sname,
|  |  | tname
| ) |  | __CTEST_INTERNAL(sname, tname, 0)

## ◆ CTEST2

#define CTEST2 | ( |  | sname,
|  |  | tname
| ) |  | __CTEST2_INTERNAL(sname, tname, 0)

## ◆ CTEST2_SKIP

#define CTEST2_SKIP | ( |  | sname,
|  |  | tname
| ) |  | __CTEST2_INTERNAL(sname, tname, 1)

## ◆ CTEST_DATA

#define CTEST_DATA | ( |  | sname | ) | struct sname##_data

## ◆ CTEST_SETUP

#define CTEST_SETUP | ( |  | sname | ) | void WEAK sname##_setup(struct sname##_data* data)

## ◆ CTEST_SKIP

#define CTEST_SKIP | ( |  | sname,
|  |  | tname
| ) |  | __CTEST_INTERNAL(sname, tname, 1)

## ◆ CTEST_TEARDOWN

#define CTEST_TEARDOWN | ( |  | sname | ) | void WEAK sname##_teardown(struct sname##_data* data)

## ◆ SETUP_FNAME

#define SETUP_FNAME | ( |  | sname | ) | sname##_setup

## ◆ TEARDOWN_FNAME

#define TEARDOWN_FNAME | ( |  | sname | ) | sname##_teardown

## ◆ WEAK

#define WEAK __attribute__ ((weak))

## Typedef Documentation

## ◆ SetupFunc

typedef void(* SetupFunc) (void *)

## ◆ TearDownFunc

typedef void(* TearDownFunc) (void *)

## Function Documentation

## ◆ assert_data()

void assert_data | ( | const unsigned char * | exp,
|  | size_t | expsize,
|  | const unsigned char * | real,
|  | size_t | realsize,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_dbl_far()

void assert_dbl_far | ( | double | exp,
|  | double | real,
|  | double | tol,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_dbl_near()

void assert_dbl_near | ( | double | exp,
|  | double | real,
|  | double | tol,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_equal()

void assert_equal | ( | intmax_t | exp,
|  | intmax_t | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_equal_u()

void assert_equal_u | ( | uintmax_t | exp,
|  | uintmax_t | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_fail()

void assert_fail | ( | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_false()

void assert_false | ( | int | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_interval()

void assert_interval | ( | intmax_t | exp1,
|  | intmax_t | exp2,
|  | intmax_t | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_not_equal()

void assert_not_equal | ( | intmax_t | exp,
|  | intmax_t | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_not_equal_u()

void assert_not_equal_u | ( | uintmax_t | exp,
|  | uintmax_t | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_not_null()

void assert_not_null | ( | const void * | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_null()

void assert_null | ( | void * | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_str()

void assert_str | ( | const char * | exp,
|  | const char * | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ assert_true()

void assert_true | ( | int | real,
|  | const char * | caller,
|  | int | line
| ) |  |

## ◆ CTEST_ERR()

void CTEST_ERR | ( | const char * | fmt,
|  |  | ...
| ) |  |

## ◆ CTEST_LOG()

void CTEST_LOG | ( | const char * | fmt,
|  |  | ...
| ) |  |