add some functions to convert input char to dimension and tensor

This commit is contained in:
2024-02-25 00:53:57 +01:00
parent ef107c11db
commit c1409546ef
18 changed files with 688 additions and 128 deletions
+6 -6
View File
@@ -4,7 +4,7 @@
#include "ftest/ftest.h"
#include "tools_t/tools_t.h"
#define INFINITY -8
#define ININITY_REPS -8
#define INITSTATE -1
#define DONOTHING 0
@@ -33,8 +33,8 @@ struct func_mock_info_struct{
int expect_call;/* 1 if EXPECT_MOCK_CALL and 0 if WILL_MOCK_CALL */
long call;/* increment when call (try to executed) and 0 if not : init value */
long failed_call;/* increment when condition not fill and 0 if not : init value */
long init_times_left;/* DONOTHING do nothing (pass to -> next), INFINITY every time; INITSTATE init; > 0 execute and decrement */
long times_left;/* DONOTHING do nothing (pass to -> next), INFINITY every time; INITSTATE init; > 0 execute and decrement */
long init_times_left;/* DONOTHING do nothing (pass to -> next), ININITY_REPS every time; INITSTATE init; > 0 execute and decrement */
long times_left;/* DONOTHING do nothing (pass to -> next), ININITY_REPS every time; INITSTATE init; > 0 execute and decrement */
struct func_mock_info_struct *next;
};
@@ -65,8 +65,8 @@ extern struct list_base_fmock *g_list_base_fmock;
#if 0
int expect_call; /* 1 if EXPECT_MOCK_CALL and 0 if WILL_MOCK_CALL */\
long init_times_left; /* DONOTHING do nothing (pass to -> next), INFINITY every time; INITSTATE init; > 0 execute and decrement */\
long times_left; /* DONOTHING do nothing (pass to -> next), INFINITY every time; INITSTATE init; > 0 execute and decrement */\
long init_times_left; /* DONOTHING do nothing (pass to -> next), ININITY_REPS every time; INITSTATE init; > 0 execute and decrement */\
long times_left; /* DONOTHING do nothing (pass to -> next), ININITY_REPS every time; INITSTATE init; > 0 execute and decrement */\
#endif
@@ -191,7 +191,7 @@ extern struct list_base_fmock *g_list_base_fmock;
PRINT_HK_C(RED_K,tab_hk_f[hk_TR]," 1 argument check failed from %s \n",__func__); \
}*/\
PRINT_DEBUG(" %*c VALUES: mock function:%s, conditions:%s t_left:%ld, init_left:%ld| args:%s\n",8,'^',(tmp_mock->info_mock)->str_namefunc, (tmp_mock->info_mock)->str_conditions, (tmp_mock->info_mock)->times_left,(tmp_mock->info_mock)->init_times_left, #args_call_with_parenthesis);\
if (((tmp_mock->info_mock)->times_left <= INFINITY) || ((tmp_mock->info_mock)->times_left > 0)){\
if (((tmp_mock->info_mock)->times_left <= ININITY_REPS) || ((tmp_mock->info_mock)->times_left > 0)){\
--((tmp_mock->info_mock)->times_left);\
PRINT_DEBUG(" %*c VALUES: mock function:%s, conditions:%s t_left:%ld, init_left:%ld| args:%s\n",8,'v',(tmp_mock->info_mock)->str_namefunc, (tmp_mock->info_mock)->str_conditions, (tmp_mock->info_mock)->times_left,(tmp_mock->info_mock)->init_times_left, #args_call_with_parenthesis);\
if(1 == tmp_mock->call_mock_condition args_call_with_parenthesis){\
@@ -118,6 +118,16 @@ GENERATE_ALL(TYPE_DOUBLE)
GENERATE_ALL(TYPE_L_DOUBLE)
GENERATE_ALL(TYPE_STRING)
/* strto_type */
int strto_TYPE_INT(char *str, char **endptr);
unsigned int strto_TYPE_U_INT(char *str, char **endptr);
long int strto_TYPE_L_INT(char *str, char **endptr);
unsigned long int strto_TYPE_U_L_INT(char *str, char **endptr);
size_t strto_TYPE_SIZE_T(char *str, char **endptr);
float strto_TYPE_FLOAT(char *str, char **endptr);
double strto_TYPE_DOUBLE(char *str, char **endptr);
long double strto_TYPE_L_DOUBLE(char *str, char **endptr);
/*
* time calucl