Mohammad Azim Khan | fff4904 | 2017-03-28 01:48:31 +0100 | [diff] [blame^] | 1 | #line 2 "suites/mbed_test.function" |
| 2 | /* |
| 3 | * *** THIS FILE HAS BEEN MACHINE GENERATED *** |
| 4 | * |
| 5 | * This file has been machine generated using the script: |
| 6 | * {generator_script} |
| 7 | * |
| 8 | * Test file : {test_file} |
| 9 | * |
| 10 | * The following files were used to create this file. |
| 11 | * |
| 12 | * Main code file : {test_main_file} |
| 13 | * Platform code file : {test_platform_file} |
| 14 | * Helper file : {test_common_helper_file} |
| 15 | * Test suite file : {test_case_file} |
| 16 | * Test suite data : {test_case_data_file} |
| 17 | * |
| 18 | * |
| 19 | * This file is part of mbed TLS (https://tls.mbed.org) |
| 20 | */ |
| 21 | |
| 22 | #if !defined(MBEDTLS_CONFIG_FILE) |
| 23 | #include <mbedtls/config.h> |
| 24 | #else |
| 25 | #include MBEDTLS_CONFIG_FILE |
| 26 | #endif |
| 27 | |
| 28 | |
| 29 | /*----------------------------------------------------------------------------*/ |
| 30 | /* Common helper code */ |
| 31 | |
| 32 | {test_common_helpers} |
| 33 | |
| 34 | #line {line_no} "suites/mbed_test.function" |
| 35 | |
| 36 | |
| 37 | /*----------------------------------------------------------------------------*/ |
| 38 | /* Test Suite Code */ |
| 39 | |
| 40 | |
| 41 | #define TEST_SUITE_ACTIVE |
| 42 | |
| 43 | {function_headers} |
| 44 | |
| 45 | {functions_code} |
| 46 | |
| 47 | #line {line_no} "suites/mbed_test.function" |
| 48 | |
| 49 | |
| 50 | /*----------------------------------------------------------------------------*/ |
| 51 | /* Test dispatch code */ |
| 52 | |
| 53 | |
| 54 | /** |
| 55 | * \brief Evaluates an expression/macro into its literal integer value. |
| 56 | * For optimizing space for embedded targets each expression/macro |
| 57 | * is identified by a unique identifier instead of string literals. |
| 58 | * Identifiers and evaluation code is generated by script: |
| 59 | * {generator_script} |
| 60 | * |
| 61 | * \param exp_id Expression identifier. |
| 62 | * \param out_value Pointer to int to hold the integer. |
| 63 | * |
| 64 | * \return 0 if exp_id is found. 1 otherwise. |
| 65 | */ |
| 66 | int get_expression( int32_t exp_id, int32_t * out_value ) |
| 67 | {{ |
| 68 | {expression_code} |
| 69 | #line {line_no} "suites/mbed_test.function" |
| 70 | {{ |
| 71 | return( KEY_VALUE_MAPPING_NOT_FOUND ); |
| 72 | }} |
| 73 | return( KEY_VALUE_MAPPING_FOUND ); |
| 74 | }} |
| 75 | |
| 76 | |
| 77 | /** |
| 78 | * \brief Checks if the dependency i.e. the compile flag is set. |
| 79 | * For optimizing space for embedded targets each dependency |
| 80 | * is identified by a unique identifier instead of string literals. |
| 81 | * Identifiers and check code is generated by script: |
| 82 | * {generator_script} |
| 83 | * |
| 84 | * \param exp_id Dependency identifier. |
| 85 | * |
| 86 | * \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED |
| 87 | */ |
| 88 | int dep_check( int dep_id ) |
| 89 | {{ |
| 90 | {dep_check_code} |
| 91 | #line {line_no} "suites/mbed_test.function" |
| 92 | {{ |
| 93 | return( DEPENDENCY_NOT_SUPPORTED ); |
| 94 | }} |
| 95 | }} |
| 96 | |
| 97 | |
| 98 | /** |
| 99 | * \brief Function pointer type for test function wrappers. |
| 100 | * |
| 101 | * |
| 102 | * \param void ** Pointer to void pointers. Represents an array of test |
| 103 | * function parameters. |
| 104 | * |
| 105 | * \return void |
| 106 | */ |
| 107 | typedef void (*TestWrapper_t)( void ** ); |
| 108 | |
| 109 | |
| 110 | /** |
| 111 | * \brief Table of test function wrappers. Used by dispatch_test(). |
| 112 | * This table is populated by script: |
| 113 | * {generator_script} |
| 114 | * |
| 115 | */ |
| 116 | TestWrapper_t test_funcs[] = |
| 117 | {{ |
| 118 | {dispatch_code} |
| 119 | #line {line_no} "suites/mbed_test.function" |
| 120 | }}; |
| 121 | |
| 122 | |
| 123 | /** |
| 124 | * \brief Dispatches test functions based on function index. |
| 125 | * |
| 126 | * \param exp_id Test function index. |
| 127 | * |
| 128 | * \return DISPATCH_TEST_SUCCESS if found |
| 129 | * DISPATCH_TEST_FN_NOT_FOUND if not found |
| 130 | * DISPATCH_UNSUPPORTED_SUITE if not compile time enabled. |
| 131 | */ |
| 132 | int dispatch_test( int func_idx, void ** params ) |
| 133 | {{ |
| 134 | int ret = DISPATCH_TEST_SUCCESS; |
| 135 | TestWrapper_t fp = NULL; |
| 136 | |
| 137 | if ( func_idx < (int)( sizeof(test_funcs)/sizeof( TestWrapper_t ) ) ) |
| 138 | {{ |
| 139 | fp = test_funcs[func_idx]; |
| 140 | if ( fp ) |
| 141 | fp( params ); |
| 142 | else |
| 143 | ret = ( DISPATCH_UNSUPPORTED_SUITE ); |
| 144 | }} else |
| 145 | {{ |
| 146 | ret = ( DISPATCH_TEST_FN_NOT_FOUND ); |
| 147 | }} |
| 148 | |
| 149 | return( ret ); |
| 150 | }} |
| 151 | |
| 152 | |
| 153 | {platform_code} |
| 154 | |
| 155 | #line {line_no} "suites/mbed_test.function" |
| 156 | |
| 157 | /*----------------------------------------------------------------------------*/ |
| 158 | /* Main Test code */ |
| 159 | |
| 160 | |
| 161 | /** |
| 162 | * \brief Program main. Invokes platform specific execute_tests(). |
| 163 | * |
| 164 | * \param argc Command line arguments count. |
| 165 | * \param argv Array of command line arguments. |
| 166 | * |
| 167 | * \return Exit code. |
| 168 | */ |
| 169 | int main( int argc, const char *argv[] ) |
| 170 | {{ |
| 171 | return execute_tests( argc, argv ); |
| 172 | }} |
| 173 | |