1 /* 2 * Copyright © 2015 Samsung Electronics Co., Ltd 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files (the 6 * "Software"), to deal in the Software without restriction, including 7 * without limitation the rights to use, copy, modify, merge, publish, 8 * distribute, sublicense, and/or sell copies of the Software, and to 9 * permit persons to whom the Software is furnished to do so, subject to 10 * the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the 13 * next paragraph) shall be included in all copies or substantial 14 * portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 23 * SOFTWARE. 24 */ 25 26 #ifndef Z_UNIT_C_IMPL_H 27 #define Z_UNIT_C_IMPL_H 28 29 /** 30 * @file 31 * Internal details to bridge the public API - should not be used 32 * directly in user code. 33 */ 34 35 #include <stdbool.h> 36 #include <stdint.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 enum zuc_check_op 43 { 44 ZUC_OP_TRUE, 45 ZUC_OP_FALSE, 46 ZUC_OP_NULL, 47 ZUC_OP_NOT_NULL, 48 ZUC_OP_EQ, 49 ZUC_OP_NE, 50 ZUC_OP_GE, 51 ZUC_OP_GT, 52 ZUC_OP_LE, 53 ZUC_OP_LT, 54 ZUC_OP_TERMINATE, 55 ZUC_OP_TRACEPOINT 56 }; 57 58 enum zuc_check_valtype 59 { 60 ZUC_VAL_INT, 61 ZUC_VAL_CSTR, 62 ZUC_VAL_PTR, 63 }; 64 65 typedef void (*zucimpl_test_fn)(void); 66 67 typedef void (*zucimpl_test_fn_f)(void *); 68 69 /** 70 * Internal use structure for automatic test case registration. 71 * Should not be used directly in code. 72 */ 73 struct zuc_registration { 74 const char *tcase; /**< Name of the test case. */ 75 const char *test; /**< Name of the specific test. */ 76 const struct zuc_fixture* fxt; /**< Optional fixture for test/case. */ 77 zucimpl_test_fn fn; /**< function implementing base test. */ 78 zucimpl_test_fn_f fn_f; /**< function implementing test with 79 fixture. */ 80 } __attribute__ ((aligned (32))); 81 82 83 int 84 zucimpl_run_tests(void); 85 86 void 87 zucimpl_terminate(char const *file, int line, 88 bool fail, bool fatal, const char *msg); 89 90 int 91 zucimpl_tracepoint(char const *file, int line, const char *fmt, ...) 92 __attribute__ ((format (printf, 3, 4))); 93 94 int 95 zucimpl_expect_pred2(char const *file, int line, 96 enum zuc_check_op, enum zuc_check_valtype valtype, 97 bool fatal, 98 intptr_t lhs, intptr_t rhs, 99 const char *lhs_str, const char* rhs_str); 100 101 #ifdef __cplusplus 102 } 103 #endif 104 105 #endif /* Z_UNIT_C_IMPL_H */ 106