gitee.com/quant1x/num@v0.3.2/asm/src/munit.h (about)

     1  /* µnit Testing Framework
     2   * Copyright (c) 2013-2017 Evan Nemerson <evan@nemerson.com>
     3   *
     4   * Permission is hereby granted, free of charge, to any person
     5   * obtaining a copy of this software and associated documentation
     6   * files (the "Software"), to deal in the Software without
     7   * restriction, including without limitation the rights to use, copy,
     8   * modify, merge, publish, distribute, sublicense, and/or sell copies
     9   * of the Software, and to permit persons to whom the Software is
    10   * furnished to do so, subject to the following conditions:
    11   *
    12   * The above copyright notice and this permission notice shall be
    13   * included in all copies or substantial portions of the Software.
    14   *
    15   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    16   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    17   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    18   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
    19   * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    20   * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    21   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    22   * SOFTWARE.
    23   */
    24  
    25  #if !defined(MUNIT_H)
    26  #define MUNIT_H
    27  
    28  #include <stdarg.h>
    29  #include <stdlib.h>
    30  
    31  #define MUNIT_VERSION(major, minor, revision) \
    32    (((major) << 16) | ((minor) << 8) | (revision))
    33  
    34  #define MUNIT_CURRENT_VERSION MUNIT_VERSION(0, 4, 1)
    35  
    36  #if defined(_MSC_VER) && (_MSC_VER < 1600)
    37  #  define munit_int8_t   __int8
    38  #  define munit_uint8_t  unsigned __int8
    39  #  define munit_int16_t  __int16
    40  #  define munit_uint16_t unsigned __int16
    41  #  define munit_int32_t  __int32
    42  #  define munit_uint32_t unsigned __int32
    43  #  define munit_int64_t  __int64
    44  #  define munit_uint64_t unsigned __int64
    45  #else
    46  #  include <stdint.h>
    47  #  define munit_int8_t   int8_t
    48  #  define munit_uint8_t  uint8_t
    49  #  define munit_int16_t  int16_t
    50  #  define munit_uint16_t uint16_t
    51  #  define munit_int32_t  int32_t
    52  #  define munit_uint32_t uint32_t
    53  #  define munit_int64_t  int64_t
    54  #  define munit_uint64_t uint64_t
    55  #endif
    56  
    57  #if defined(_MSC_VER) && (_MSC_VER < 1800)
    58  #  if !defined(PRIi8)
    59  #    define PRIi8 "i"
    60  #  endif
    61  #  if !defined(PRIi16)
    62  #    define PRIi16 "i"
    63  #  endif
    64  #  if !defined(PRIi32)
    65  #    define PRIi32 "i"
    66  #  endif
    67  #  if !defined(PRIi64)
    68  #    define PRIi64 "I64i"
    69  #  endif
    70  #  if !defined(PRId8)
    71  #    define PRId8 "d"
    72  #  endif
    73  #  if !defined(PRId16)
    74  #    define PRId16 "d"
    75  #  endif
    76  #  if !defined(PRId32)
    77  #    define PRId32 "d"
    78  #  endif
    79  #  if !defined(PRId64)
    80  #    define PRId64 "I64d"
    81  #  endif
    82  #  if !defined(PRIx8)
    83  #    define PRIx8 "x"
    84  #  endif
    85  #  if !defined(PRIx16)
    86  #    define PRIx16 "x"
    87  #  endif
    88  #  if !defined(PRIx32)
    89  #    define PRIx32 "x"
    90  #  endif
    91  #  if !defined(PRIx64)
    92  #    define PRIx64 "I64x"
    93  #  endif
    94  #  if !defined(PRIu8)
    95  #    define PRIu8 "u"
    96  #  endif
    97  #  if !defined(PRIu16)
    98  #    define PRIu16 "u"
    99  #  endif
   100  #  if !defined(PRIu32)
   101  #    define PRIu32 "u"
   102  #  endif
   103  #  if !defined(PRIu64)
   104  #    define PRIu64 "I64u"
   105  #  endif
   106  #else
   107  #  include <inttypes.h>
   108  #endif
   109  
   110  #if !defined(munit_bool)
   111  #  if defined(bool)
   112  #    define munit_bool bool
   113  #  elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
   114  #    define munit_bool _Bool
   115  #  else
   116  #    define munit_bool int
   117  #  endif
   118  #endif
   119  
   120  #if defined(__cplusplus)
   121  extern "C" {
   122  #endif
   123  
   124  #if defined(__GNUC__)
   125  #  define MUNIT_LIKELY(expr) (__builtin_expect ((expr), 1))
   126  #  define MUNIT_UNLIKELY(expr) (__builtin_expect ((expr), 0))
   127  #  define MUNIT_UNUSED __attribute__((__unused__))
   128  #else
   129  #  define MUNIT_LIKELY(expr) (expr)
   130  #  define MUNIT_UNLIKELY(expr) (expr)
   131  #  define MUNIT_UNUSED
   132  #endif
   133  
   134  #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__PGI)
   135  #  define MUNIT_ARRAY_PARAM(name) name
   136  #else
   137  #  define MUNIT_ARRAY_PARAM(name)
   138  #endif
   139  
   140  #if !defined(_WIN32)
   141  #  define MUNIT_SIZE_MODIFIER "z"
   142  #  define MUNIT_CHAR_MODIFIER "hh"
   143  #  define MUNIT_SHORT_MODIFIER "h"
   144  #else
   145  #  if defined(_M_X64) || defined(__amd64__)
   146  #    define MUNIT_SIZE_MODIFIER "I64"
   147  #  else
   148  #    define MUNIT_SIZE_MODIFIER ""
   149  #  endif
   150  #  define MUNIT_CHAR_MODIFIER ""
   151  #  define MUNIT_SHORT_MODIFIER ""
   152  #endif
   153  
   154  #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
   155  #  define MUNIT_NO_RETURN _Noreturn
   156  #elif defined(__GNUC__)
   157  #  define MUNIT_NO_RETURN __attribute__((__noreturn__))
   158  #elif defined(_MSC_VER)
   159  #  define MUNIT_NO_RETURN __declspec(noreturn)
   160  #else
   161  #  define MUNIT_NO_RETURN
   162  #endif
   163  
   164  #if defined(_MSC_VER) &&  (_MSC_VER >= 1500)
   165  #  define MUNIT_PUSH_DISABLE_MSVC_C4127_ __pragma(warning(push)) __pragma(warning(disable:4127))
   166  #  define MUNIT_POP_DISABLE_MSVC_C4127_ __pragma(warning(pop))
   167  #else
   168  #  define MUNIT_PUSH_DISABLE_MSVC_C4127_
   169  #  define MUNIT_POP_DISABLE_MSVC_C4127_
   170  #endif
   171  
   172  typedef enum {
   173    MUNIT_LOG_DEBUG,
   174    MUNIT_LOG_INFO,
   175    MUNIT_LOG_WARNING,
   176    MUNIT_LOG_ERROR
   177  } MunitLogLevel;
   178  
   179  #if defined(__GNUC__) && !defined(__MINGW32__)
   180  #  define MUNIT_PRINTF(string_index, first_to_check) __attribute__((format (printf, string_index, first_to_check)))
   181  #else
   182  #  define MUNIT_PRINTF(string_index, first_to_check)
   183  #endif
   184  
   185  MUNIT_PRINTF(4, 5)
   186  void munit_logf_ex(MunitLogLevel level, const char* filename, int line, const char* format, ...);
   187  
   188  #define munit_logf(level, format, ...) \
   189    munit_logf_ex(level, __FILE__, __LINE__, format, __VA_ARGS__)
   190  
   191  #define munit_log(level, msg) \
   192    munit_logf(level, "%s", msg)
   193  
   194  MUNIT_NO_RETURN
   195  MUNIT_PRINTF(3, 4)
   196  void munit_errorf_ex(const char* filename, int line, const char* format, ...);
   197  
   198  #define munit_errorf(format, ...) \
   199    munit_errorf_ex(__FILE__, __LINE__, format, __VA_ARGS__)
   200  
   201  #define munit_error(msg) \
   202    munit_errorf("%s", msg)
   203  
   204  #define munit_assert(expr) \
   205    do { \
   206      if (!MUNIT_LIKELY(expr)) { \
   207        munit_error("assertion failed: " #expr); \
   208      } \
   209      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   210    } while (0) \
   211    MUNIT_POP_DISABLE_MSVC_C4127_
   212  
   213  #define munit_assert_true(expr) \
   214    do { \
   215      if (!MUNIT_LIKELY(expr)) { \
   216        munit_error("assertion failed: " #expr " is not true"); \
   217      } \
   218      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   219    } while (0) \
   220    MUNIT_POP_DISABLE_MSVC_C4127_
   221  
   222  #define munit_assert_false(expr) \
   223    do { \
   224      if (!MUNIT_LIKELY(!(expr))) { \
   225        munit_error("assertion failed: " #expr " is not false"); \
   226      } \
   227      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   228    } while (0) \
   229    MUNIT_POP_DISABLE_MSVC_C4127_
   230  
   231  #define munit_assert_type_full(prefix, suffix, T, fmt, a, op, b)   \
   232    do { \
   233      T munit_tmp_a_ = (a); \
   234      T munit_tmp_b_ = (b); \
   235      if (!(munit_tmp_a_ op munit_tmp_b_)) {                               \
   236        munit_errorf("assertion failed: %s %s %s (" prefix "%" fmt suffix " %s " prefix "%" fmt suffix ")", \
   237                     #a, #op, #b, munit_tmp_a_, #op, munit_tmp_b_); \
   238      } \
   239      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   240    } while (0) \
   241    MUNIT_POP_DISABLE_MSVC_C4127_
   242  
   243  #define munit_assert_type(T, fmt, a, op, b) \
   244    munit_assert_type_full("", "", T, fmt, a, op, b)
   245  
   246  #define munit_assert_char(a, op, b) \
   247    munit_assert_type_full("'\\x", "'", char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)
   248  #define munit_assert_uchar(a, op, b) \
   249    munit_assert_type_full("'\\x", "'", unsigned char, "02" MUNIT_CHAR_MODIFIER "x", a, op, b)
   250  #define munit_assert_short(a, op, b) \
   251    munit_assert_type(short, MUNIT_SHORT_MODIFIER "d", a, op, b)
   252  #define munit_assert_ushort(a, op, b) \
   253    munit_assert_type(unsigned short, MUNIT_SHORT_MODIFIER "u", a, op, b)
   254  #define munit_assert_int(a, op, b) \
   255    munit_assert_type(int, "d", a, op, b)
   256  #define munit_assert_uint(a, op, b) \
   257    munit_assert_type(unsigned int, "u", a, op, b)
   258  #define munit_assert_long(a, op, b) \
   259    munit_assert_type(long int, "ld", a, op, b)
   260  #define munit_assert_ulong(a, op, b) \
   261    munit_assert_type(unsigned long int, "lu", a, op, b)
   262  #define munit_assert_llong(a, op, b) \
   263    munit_assert_type(long long int, "lld", a, op, b)
   264  #define munit_assert_ullong(a, op, b) \
   265    munit_assert_type(unsigned long long int, "llu", a, op, b)
   266  
   267  #define munit_assert_size(a, op, b) \
   268    munit_assert_type(size_t, MUNIT_SIZE_MODIFIER "u", a, op, b)
   269  
   270  #define munit_assert_float(a, op, b) \
   271    munit_assert_type(float, "f", a, op, b)
   272  #define munit_assert_double(a, op, b) \
   273    munit_assert_type(double, "g", a, op, b)
   274  #define munit_assert_ptr(a, op, b) \
   275    munit_assert_type(const void*, "p", a, op, b)
   276  
   277  #define munit_assert_int8(a, op, b)             \
   278    munit_assert_type(munit_int8_t, PRIi8, a, op, b)
   279  #define munit_assert_uint8(a, op, b) \
   280    munit_assert_type(munit_uint8_t, PRIu8, a, op, b)
   281  #define munit_assert_int16(a, op, b) \
   282    munit_assert_type(munit_int16_t, PRIi16, a, op, b)
   283  #define munit_assert_uint16(a, op, b) \
   284    munit_assert_type(munit_uint16_t, PRIu16, a, op, b)
   285  #define munit_assert_int32(a, op, b) \
   286    munit_assert_type(munit_int32_t, PRIi32, a, op, b)
   287  #define munit_assert_uint32(a, op, b) \
   288    munit_assert_type(munit_uint32_t, PRIu32, a, op, b)
   289  #define munit_assert_int64(a, op, b) \
   290    munit_assert_type(munit_int64_t, PRIi64, a, op, b)
   291  #define munit_assert_uint64(a, op, b) \
   292    munit_assert_type(munit_uint64_t, PRIu64, a, op, b)
   293  
   294  #define munit_assert_double_equal(a, b, precision) \
   295    do { \
   296      const double munit_tmp_a_ = (a); \
   297      const double munit_tmp_b_ = (b); \
   298      const double munit_tmp_diff_ = ((munit_tmp_a_ - munit_tmp_b_) < 0) ? \
   299        -(munit_tmp_a_ - munit_tmp_b_) : \
   300        (munit_tmp_a_ - munit_tmp_b_); \
   301      if (MUNIT_UNLIKELY(munit_tmp_diff_ > 1e-##precision)) { \
   302        munit_errorf("assertion failed: %s == %s (%0." #precision "g == %0." #precision "g)", \
   303  		   #a, #b, munit_tmp_a_, munit_tmp_b_); \
   304      } \
   305      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   306    } while (0) \
   307    MUNIT_POP_DISABLE_MSVC_C4127_
   308  
   309  #define munit_assert_float_equal(a, b, precision) \
   310    do { \
   311      const float munit_tmp_a_ = (a); \
   312      const float munit_tmp_b_ = (b); \
   313      const float munit_tmp_diff_ = ((munit_tmp_a_ - munit_tmp_b_) < 0) ? \
   314        -(munit_tmp_a_ - munit_tmp_b_) : \
   315        (munit_tmp_a_ - munit_tmp_b_); \
   316      if (MUNIT_UNLIKELY(munit_tmp_diff_ > 1e-##precision)) { \
   317        munit_errorf("assertion failed: %s == %s (%0." #precision "g == %0." #precision "g)", \
   318  		   #a, #b, munit_tmp_a_, munit_tmp_b_); \
   319      } \
   320      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   321    } while (0) \
   322    MUNIT_POP_DISABLE_MSVC_C4127_
   323  
   324  #include <string.h>
   325  #define munit_assert_string_equal(a, b) \
   326    do { \
   327      const char* munit_tmp_a_ = a; \
   328      const char* munit_tmp_b_ = b; \
   329      if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) != 0)) { \
   330        munit_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")", \
   331                     #a, #b, munit_tmp_a_, munit_tmp_b_); \
   332      } \
   333      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   334    } while (0) \
   335    MUNIT_POP_DISABLE_MSVC_C4127_
   336  
   337  #define munit_assert_string_not_equal(a, b) \
   338    do { \
   339      const char* munit_tmp_a_ = a; \
   340      const char* munit_tmp_b_ = b; \
   341      if (MUNIT_UNLIKELY(strcmp(munit_tmp_a_, munit_tmp_b_) == 0)) { \
   342        munit_errorf("assertion failed: string %s != %s (\"%s\" == \"%s\")", \
   343                     #a, #b, munit_tmp_a_, munit_tmp_b_); \
   344      } \
   345      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   346    } while (0) \
   347    MUNIT_POP_DISABLE_MSVC_C4127_
   348  
   349  #define munit_assert_floats_equal(size, a, b) \
   350    do { \
   351      const float* munit_tmp_a_ = (const float*) (a); \
   352      const float* munit_tmp_b_ = (const float*) (b); \
   353      const size_t munit_tmp_size_ = (size); \
   354      if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_ * sizeof(float))) != 0) { \
   355        size_t munit_tmp_pos_; \
   356        for (munit_tmp_pos_ = 0 ; munit_tmp_pos_ < munit_tmp_size_ ; munit_tmp_pos_++) { \
   357          if (munit_tmp_a_[munit_tmp_pos_] != munit_tmp_b_[munit_tmp_pos_]) { \
   358            munit_errorf("assertion failed: floats %s == %s (%f == %f), at offset %" MUNIT_SIZE_MODIFIER "u", \
   359                         #a, #b, munit_tmp_a_[munit_tmp_pos_], munit_tmp_b_[munit_tmp_pos_], munit_tmp_pos_); \
   360            break; \
   361          } \
   362        } \
   363      } \
   364      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   365    } while (0) \
   366    MUNIT_POP_DISABLE_MSVC_C4127_
   367  
   368  #define munit_assert_memory_equal(size, a, b) \
   369    do { \
   370      const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
   371      const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
   372      const size_t munit_tmp_size_ = (size); \
   373      if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) != 0) { \
   374        size_t munit_tmp_pos_; \
   375        for (munit_tmp_pos_ = 0 ; munit_tmp_pos_ < munit_tmp_size_ ; munit_tmp_pos_++) { \
   376          if (munit_tmp_a_[munit_tmp_pos_] != munit_tmp_b_[munit_tmp_pos_]) { \
   377            munit_errorf("assertion failed: memory %s == %s, at offset %" MUNIT_SIZE_MODIFIER "u", \
   378                         #a, #b, munit_tmp_pos_); \
   379            break; \
   380          } \
   381        } \
   382      } \
   383      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   384    } while (0) \
   385    MUNIT_POP_DISABLE_MSVC_C4127_
   386  
   387  #define munit_assert_memory_not_equal(size, a, b) \
   388    do { \
   389      const unsigned char* munit_tmp_a_ = (const unsigned char*) (a); \
   390      const unsigned char* munit_tmp_b_ = (const unsigned char*) (b); \
   391      const size_t munit_tmp_size_ = (size); \
   392      if (MUNIT_UNLIKELY(memcmp(munit_tmp_a_, munit_tmp_b_, munit_tmp_size_)) == 0) { \
   393        munit_errorf("assertion failed: memory %s != %s (%zu bytes)", \
   394                     #a, #b, munit_tmp_size_); \
   395      } \
   396      MUNIT_PUSH_DISABLE_MSVC_C4127_ \
   397    } while (0) \
   398    MUNIT_POP_DISABLE_MSVC_C4127_
   399  
   400  #define munit_assert_ptr_equal(a, b) \
   401    munit_assert_ptr(a, ==, b)
   402  #define munit_assert_ptr_not_equal(a, b) \
   403    munit_assert_ptr(a, !=, b)
   404  #define munit_assert_null(ptr) \
   405    munit_assert_ptr(ptr, ==, NULL)
   406  #define munit_assert_not_null(ptr) \
   407    munit_assert_ptr(ptr, !=, NULL)
   408  #define munit_assert_ptr_null(ptr) \
   409    munit_assert_ptr(ptr, ==, NULL)
   410  #define munit_assert_ptr_not_null(ptr) \
   411    munit_assert_ptr(ptr, !=, NULL)
   412  
   413  /*** Memory allocation ***/
   414  
   415  void* munit_malloc_ex(const char* filename, int line, size_t size);
   416  
   417  #define munit_malloc(size) \
   418    munit_malloc_ex(__FILE__, __LINE__, (size))
   419  
   420  #define munit_new(type) \
   421    ((type*) munit_malloc(sizeof(type)))
   422  
   423  #define munit_calloc(nmemb, size) \
   424    munit_malloc((nmemb) * (size))
   425  
   426  #define munit_newa(type, nmemb) \
   427    ((type*) munit_calloc((nmemb), sizeof(type)))
   428  
   429  /*** Random number generation ***/
   430  
   431  void munit_rand_seed(munit_uint32_t seed);
   432  munit_uint32_t munit_rand_uint32(void);
   433  int munit_rand_int_range(int min, int max);
   434  double munit_rand_double(void);
   435  void munit_rand_memory(size_t size, munit_uint8_t buffer[MUNIT_ARRAY_PARAM(size)]);
   436  
   437  /*** Tests and Suites ***/
   438  
   439  typedef enum {
   440    /* Test successful */
   441    MUNIT_OK,
   442    /* Test failed */
   443    MUNIT_FAIL,
   444    /* Test was skipped */
   445    MUNIT_SKIP,
   446    /* Test failed due to circumstances not intended to be tested
   447     * (things like network errors, invalid parameter value, failure to
   448     * allocate memory in the test harness, etc.). */
   449    MUNIT_ERROR
   450  } MunitResult;
   451  
   452  typedef struct {
   453    char*  name;
   454    char** values;
   455  } MunitParameterEnum;
   456  
   457  typedef struct {
   458    char* name;
   459    char* value;
   460  } MunitParameter;
   461  
   462  const char* munit_parameters_get(const MunitParameter params[], const char* key);
   463  
   464  typedef enum {
   465    MUNIT_TEST_OPTION_NONE             = 0,
   466    MUNIT_TEST_OPTION_SINGLE_ITERATION = 1 << 0,
   467    MUNIT_TEST_OPTION_TODO             = 1 << 1
   468  } MunitTestOptions;
   469  
   470  typedef MunitResult (* MunitTestFunc)(const MunitParameter params[], void* user_data_or_fixture);
   471  typedef void*       (* MunitTestSetup)(const MunitParameter params[], void* user_data);
   472  typedef void        (* MunitTestTearDown)(void* fixture);
   473  
   474  typedef struct {
   475    char*               name;
   476    MunitTestFunc       test;
   477    MunitTestSetup      setup;
   478    MunitTestTearDown   tear_down;
   479    MunitTestOptions    options;
   480    MunitParameterEnum* parameters;
   481  } MunitTest;
   482  
   483  typedef enum {
   484    MUNIT_SUITE_OPTION_NONE = 0
   485  } MunitSuiteOptions;
   486  
   487  typedef struct MunitSuite_ MunitSuite;
   488  
   489  struct MunitSuite_ {
   490    char*             prefix;
   491    MunitTest*        tests;
   492    MunitSuite*       suites;
   493    unsigned int      iterations;
   494    MunitSuiteOptions options;
   495  };
   496  
   497  int munit_suite_main(const MunitSuite* suite, void* user_data, int argc, char* const argv[MUNIT_ARRAY_PARAM(argc + 1)]);
   498  
   499  /* Note: I'm not very happy with this API; it's likely to change if I
   500   * figure out something better.  Suggestions welcome. */
   501  
   502  typedef struct MunitArgument_ MunitArgument;
   503  
   504  struct MunitArgument_ {
   505    char* name;
   506    munit_bool (* parse_argument)(const MunitSuite* suite, void* user_data, int* arg, int argc, char* const argv[MUNIT_ARRAY_PARAM(argc + 1)]);
   507    void (* write_help)(const MunitArgument* argument, void* user_data);
   508  };
   509  
   510  int munit_suite_main_custom(const MunitSuite* suite,
   511                              void* user_data,
   512                              int argc, char* const argv[MUNIT_ARRAY_PARAM(argc + 1)],
   513                              const MunitArgument arguments[]);
   514  
   515  #if defined(MUNIT_ENABLE_ASSERT_ALIASES)
   516  
   517  #define assert_true(expr) munit_assert_true(expr)
   518  #define assert_false(expr) munit_assert_false(expr)
   519  #define assert_char(a, op, b) munit_assert_char(a, op, b)
   520  #define assert_uchar(a, op, b) munit_assert_uchar(a, op, b)
   521  #define assert_short(a, op, b) munit_assert_short(a, op, b)
   522  #define assert_ushort(a, op, b) munit_assert_ushort(a, op, b)
   523  #define assert_int(a, op, b) munit_assert_int(a, op, b)
   524  #define assert_uint(a, op, b) munit_assert_uint(a, op, b)
   525  #define assert_long(a, op, b) munit_assert_long(a, op, b)
   526  #define assert_ulong(a, op, b) munit_assert_ulong(a, op, b)
   527  #define assert_llong(a, op, b) munit_assert_llong(a, op, b)
   528  #define assert_ullong(a, op, b) munit_assert_ullong(a, op, b)
   529  #define assert_size(a, op, b) munit_assert_size(a, op, b)
   530  #define assert_float(a, op, b) munit_assert_float(a, op, b)
   531  #define assert_double(a, op, b) munit_assert_double(a, op, b)
   532  #define assert_ptr(a, op, b) munit_assert_ptr(a, op, b)
   533  
   534  #define assert_int8(a, op, b) munit_assert_int8(a, op, b)
   535  #define assert_uint8(a, op, b) munit_assert_uint8(a, op, b)
   536  #define assert_int16(a, op, b) munit_assert_int16(a, op, b)
   537  #define assert_uint16(a, op, b) munit_assert_uint16(a, op, b)
   538  #define assert_int32(a, op, b) munit_assert_int32(a, op, b)
   539  #define assert_uint32(a, op, b) munit_assert_uint32(a, op, b)
   540  #define assert_int64(a, op, b) munit_assert_int64(a, op, b)
   541  #define assert_uint64(a, op, b) munit_assert_uint64(a, op, b)
   542  
   543  #define assert_double_equal(a, b, precision) munit_assert_double_equal(a, b, precision)
   544  #define assert_string_equal(a, b) munit_assert_string_equal(a, b)
   545  #define assert_string_not_equal(a, b) munit_assert_string_not_equal(a, b)
   546  #define assert_memory_equal(size, a, b) munit_assert_memory_equal(size, a, b)
   547  #define assert_memory_not_equal(size, a, b) munit_assert_memory_not_equal(size, a, b)
   548  #define assert_ptr_equal(a, b) munit_assert_ptr_equal(a, b)
   549  #define assert_ptr_not_equal(a, b) munit_assert_ptr_not_equal(a, b)
   550  #define assert_ptr_null(ptr) munit_assert_null_equal(ptr)
   551  #define assert_ptr_not_null(ptr) munit_assert_not_null(ptr)
   552  
   553  #define assert_null(ptr) munit_assert_null(ptr)
   554  #define assert_not_null(ptr) munit_assert_not_null(ptr)
   555  
   556  #endif /* defined(MUNIT_ENABLE_ASSERT_ALIASES) */
   557  
   558  #if defined(__cplusplus)
   559  }
   560  #endif
   561  
   562  #endif /* !defined(MUNIT_H) */
   563  
   564  #if defined(MUNIT_ENABLE_ASSERT_ALIASES)
   565  #  if defined(assert)
   566  #    undef assert
   567  #  endif
   568  #  define assert(expr) munit_assert(expr)
   569  #endif