update kunity

This commit is contained in:
stubbfel
2018-02-15 20:50:35 +01:00
parent 66f19afb8c
commit 52faaaff69
5 changed files with 142 additions and 42 deletions

View File

@@ -2,18 +2,15 @@
#define KUNITY_T_H
//{ global include region
#include <linux/types.h>
#ifndef KUNITY_TEST_RUNNER_APP
#include <linux/export.h>
#endif
#include <linux/types.h>
//}
//{ local include region
//}
//{ define region
#ifndef KUNITY_LINE_SIZE
@@ -31,41 +28,59 @@
#endif
#ifndef KUNITY_CREATE_TEST_NAME
#define JOIN(x,y) x ## y
#define CONCAT(x,y) JOIN(x,y)
#define JOIN(x, y) x##y
#define CONCAT(x, y) JOIN(x, y)
#define KUNITY_CREATE_TEST_NAME(function_name) CONCAT(KUNITY_DEFAULT_TEST_NAME_PREFIX, function_name)
#endif
#ifndef KUNITY_TEST
#define KUNITY_TEST(function_name) \
extern void KUNITY_CREATE_TEST_NAME(function_name) (void); \
EXPORT_SYMBOL(KUNITY_CREATE_TEST_NAME(function_name)); \
void KUNITY_CREATE_TEST_NAME(function_name)()
#define KUNITY_TEST(function_name) \
extern result_code_e KUNITY_CREATE_TEST_NAME(function_name)(const ptr_output_functions_s output); \
static void function_name(void); \
\
result_code_e KUNITY_CREATE_TEST_NAME(function_name)(const ptr_output_functions_s output) \
{ \
return run_unity_test(function_name, output); \
} \
EXPORT_SYMBOL(KUNITY_CREATE_TEST_NAME(function_name)); \
\
static void function_name()
#endif
//}
//{ enum region
//}
typedef enum result_code_eTag {
OK,
ERROR_NULL_ARGUMENT,
ERROR_INVALID_ARGUMENT,
ERROR_INVALID_OPERATION
} result_code_e,
*ptr_result_code_e;
//}
//{ typedef region
typedef void (*redirect_char)(char a);
typedef void (*unity_test_function_ptr)(void);
//}
//{ struct region
#pragma pack(push, 1)
typedef struct string_builder_sTag
{
size_t write_postion;
char buffer[KUNITY_LINE_SIZE];
} string_builder_s, ptr_string_builder_s;
#pragma pack(pop)
typedef struct output_functions_sTag {
redirect_char redirect_char;
} output_functions_s, *ptr_output_functions_s;
typedef result_code_e (*kunity_test_function_ptr)(ptr_output_functions_s);
typedef struct test_sTag {
const char* name;
const char* modul_name;
kunity_test_function_ptr test_function;
} test_s, *ptr_test_s;
//}