Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 48003d4..11a009a 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -69,24 +69,23 @@
*
* \return 0 if exp_id is found. 1 otherwise.
*/
-int get_expression( int32_t exp_id, int32_t * out_value )
+int get_expression(int32_t exp_id, int32_t *out_value)
{
int ret = KEY_VALUE_MAPPING_FOUND;
(void) exp_id;
(void) out_value;
- switch( exp_id )
- {
-__MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
+ switch (exp_id) {
+ __MBEDTLS_TEST_TEMPLATE__EXPRESSION_CODE
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
default:
- {
- ret = KEY_VALUE_MAPPING_NOT_FOUND;
- }
- break;
+ {
+ ret = KEY_VALUE_MAPPING_NOT_FOUND;
+ }
+ break;
}
- return( ret );
+ return ret;
}
@@ -101,20 +100,19 @@
*
* \return DEPENDENCY_SUPPORTED if set else DEPENDENCY_NOT_SUPPORTED
*/
-int dep_check( int dep_id )
+int dep_check(int dep_id)
{
int ret = DEPENDENCY_NOT_SUPPORTED;
(void) dep_id;
- switch( dep_id )
- {
-__MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
+ switch (dep_id) {
+ __MBEDTLS_TEST_TEMPLATE__DEP_CHECK_CODE
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
default:
break;
}
- return( ret );
+ return ret;
}
@@ -131,7 +129,7 @@
* dereferences. Each wrapper function hard-codes the
* number and types of the parameters.
*/
-typedef void (*TestWrapper_t)( void **param_array );
+typedef void (*TestWrapper_t)(void **param_array);
/**
@@ -142,7 +140,7 @@
*/
TestWrapper_t test_funcs[] =
{
-__MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
+ __MBEDTLS_TEST_TEMPLATE__DISPATCH_CODE
#line __MBEDTLS_TEST_TEMPLATE__LINE_NO "suites/main_test.function"
};
@@ -157,35 +155,31 @@
* DISPATCH_TEST_FN_NOT_FOUND if not found
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
*/
-int dispatch_test( size_t func_idx, void ** params )
+int dispatch_test(size_t func_idx, void **params)
{
int ret = DISPATCH_TEST_SUCCESS;
TestWrapper_t fp = NULL;
- if ( func_idx < (int)( sizeof( test_funcs ) / sizeof( TestWrapper_t ) ) )
- {
+ if (func_idx < (int) (sizeof(test_funcs) / sizeof(TestWrapper_t))) {
fp = test_funcs[func_idx];
- if ( fp )
- {
+ if (fp) {
#if defined(MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG)
- mbedtls_test_enable_insecure_external_rng( );
+ mbedtls_test_enable_insecure_external_rng();
#endif
- fp( params );
+ fp(params);
#if defined(MBEDTLS_TEST_MUTEX_USAGE)
- mbedtls_test_mutex_usage_check( );
+ mbedtls_test_mutex_usage_check();
#endif /* MBEDTLS_TEST_MUTEX_USAGE */
- }
- else
+ } else {
ret = DISPATCH_UNSUPPORTED_SUITE;
- }
- else
- {
+ }
+ } else {
ret = DISPATCH_TEST_FN_NOT_FOUND;
}
- return( ret );
+ return ret;
}
@@ -199,23 +193,21 @@
* DISPATCH_TEST_FN_NOT_FOUND if not found
* DISPATCH_UNSUPPORTED_SUITE if not compile time enabled.
*/
-int check_test( size_t func_idx )
+int check_test(size_t func_idx)
{
int ret = DISPATCH_TEST_SUCCESS;
TestWrapper_t fp = NULL;
- if ( func_idx < (int)( sizeof(test_funcs)/sizeof( TestWrapper_t ) ) )
- {
+ if (func_idx < (int) (sizeof(test_funcs)/sizeof(TestWrapper_t))) {
fp = test_funcs[func_idx];
- if ( fp == NULL )
+ if (fp == NULL) {
ret = DISPATCH_UNSUPPORTED_SUITE;
- }
- else
- {
+ }
+ } else {
ret = DISPATCH_TEST_FN_NOT_FOUND;
}
- return( ret );
+ return ret;
}
@@ -235,10 +227,10 @@
*
* \return Exit code.
*/
-int main( int argc, const char *argv[] )
+int main(int argc, const char *argv[])
{
#if defined(MBEDTLS_TEST_HOOKS)
- extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const char * file );
+ extern void (*mbedtls_test_hook_test_fail)(const char *test, int line, const char *file);
mbedtls_test_hook_test_fail = &mbedtls_test_fail;
#if defined(MBEDTLS_ERROR_C)
mbedtls_test_hook_error_add = &mbedtls_test_err_add_check;
@@ -246,15 +238,14 @@
#endif
int ret = mbedtls_test_platform_setup();
- if( ret != 0 )
- {
- mbedtls_fprintf( stderr,
- "FATAL: Failed to initialize platform - error %d\n",
- ret );
- return( -1 );
+ if (ret != 0) {
+ mbedtls_fprintf(stderr,
+ "FATAL: Failed to initialize platform - error %d\n",
+ ret);
+ return -1;
}
- ret = execute_tests( argc, argv );
+ ret = execute_tests(argc, argv);
mbedtls_test_platform_teardown();
- return( ret );
+ return ret;
}