diff --git a/isgood b/isgood index 9007a8d..58888fe 100644 Binary files a/isgood and b/isgood differ diff --git a/log2 b/log2 deleted file mode 100644 index f27cc5b..0000000 --- a/log2 +++ /dev/null @@ -1,211 +0,0 @@ -In file included from ./src/permutation_t/permutation_t.h:5, - from src/permutation_t/permutation_t.c:1: -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:17:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 17 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:18:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 18 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:19:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 19 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:20:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 20 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_SIZE_T) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_CHAR’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_CHAR’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:67:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 67 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_CHAR *’ but argument is of type ‘const PERMUTATION_TYPE_CHAR *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:67:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 67 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_U_CHAR’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_U_CHAR’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:68:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 68 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_U_CHAR *’ but argument is of type ‘const PERMUTATION_TYPE_U_CHAR *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:68:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 68 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_INT’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_INT’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:69:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 69 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_INT *’ but argument is of type ‘const PERMUTATION_TYPE_INT *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:69:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 69 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_U_INT’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_U_INT’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:70:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 70 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_U_INT *’ but argument is of type ‘const PERMUTATION_TYPE_U_INT *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:70:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 70 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_L_INT’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_L_INT’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:71:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 71 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_L_INT *’ but argument is of type ‘const PERMUTATION_TYPE_L_INT *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:71:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 71 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_U_L_INT’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_U_L_INT’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:72:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 72 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_U_L_INT *’ but argument is of type ‘const PERMUTATION_TYPE_U_L_INT *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:72:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 72 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_U_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_SIZE_T’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_SIZE_T’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:73:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 73 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_SIZE_T) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_SIZE_T *’ but argument is of type ‘const PERMUTATION_TYPE_SIZE_T *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:73:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 73 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_SIZE_T) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_FLOAT’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_FLOAT’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:74:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 74 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_FLOAT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_FLOAT *’ but argument is of type ‘const PERMUTATION_TYPE_FLOAT *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:74:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 74 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_FLOAT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_DOUBLE’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_DOUBLE’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:75:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 75 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_DOUBLE) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_DOUBLE *’ but argument is of type ‘const PERMUTATION_TYPE_DOUBLE *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:75:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 75 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_DOUBLE) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_L_DOUBLE’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_L_DOUBLE’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:76:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 76 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_L_DOUBLE) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_L_DOUBLE *’ but argument is of type ‘const PERMUTATION_TYPE_L_DOUBLE *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:76:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 76 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_L_DOUBLE) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_STRING’: -src/permutation_t/permutation_t.c:39:37: warning: passing argument 2 of ‘COPY_ARRAY_TYPE_STRING’ from incompatible pointer type [-Wincompatible-pointer-types] - 39 | COPY_ARRAY_##type(sorted_perm, p->perm, size);\ - | ~^~~~~~ - | | - | char ** -src/permutation_t/permutation_t.c:77:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 77 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_STRING) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In file included from ./src/permutation_t/permutation_t.h:4, - from src/permutation_t/permutation_t.c:1: -./src/tools_t/tools_t.h:29:49: note: expected ‘const char **’ but argument is of type ‘char **’ - 29 | void COPY_ARRAY_##type(type* dst, const type* src, size_t size);\ - | ~~~~~~~~~~~~^~~ -./src/tools_t/tools_t.h:46:1: note: in expansion of macro ‘GENERATE_ALL’ - 46 | GENERATE_ALL(TYPE_STRING) - | ^~~~~~~~~~~~ -src/permutation_t/permutation_t.c: In function ‘IS_PERMUTATION_TYPE_STRING’: -src/permutation_t/permutation_t.c:60:75: warning: passing argument 1 of ‘TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_STRING’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] - 60 | PERMUTATION_TYPE_SIZE_T *t_p = TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(p);\ - | ^ -src/permutation_t/permutation_t.c:77:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 77 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_STRING) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -src/permutation_t/permutation_t.c:33:88: note: expected ‘PERMUTATION_TYPE_STRING *’ but argument is of type ‘const PERMUTATION_TYPE_STRING *’ - 33 | PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ - | ~~~~~~~~~~~~~~~~~~~~^ -src/permutation_t/permutation_t.c:77:1: note: in expansion of macro ‘GENERATE_PERMUTATION_FUNCTIONS’ - 77 | GENERATE_PERMUTATION_FUNCTIONS(TYPE_STRING) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -In file included from src/set_theoric_t/set_theoric_t.c:2: -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:17:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 17 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_CHAR) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:18:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 18 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:19:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 19 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_L_INT) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:13:18: warning: parameter names (without types) in function declaration - 13 | typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - | ^~~~~~~~~~~~ -./src/set_theoric_t/set_theoric_t.h:20:1: note: in expansion of macro ‘GENERATE_UNSIGNED_SET_THEORIC’ - 20 | GENERATE_UNSIGNED_SET_THEORIC(TYPE_SIZE_T) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/src/permutation_t/permutation_t.c b/src/permutation_t/permutation_t.c index 4a6795b..28bb305 100644 --- a/src/permutation_t/permutation_t.c +++ b/src/permutation_t/permutation_t.c @@ -30,13 +30,14 @@ GENERATE_PERMUTATION_FUNCTIONS_UNSIGNED(TYPE_SIZE_T) p->perm = malloc(size * sizeof(type));\ return p; }\ \ - PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(PERMUTATION_##type *p ){\ + PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(const PERMUTATION_##type *p ){\ if (p == NULL) return NULL;\ PERMUTATION_TYPE_SIZE_T *t_p = malloc(sizeof(PERMUTATION_TYPE_SIZE_T));\ size_t size = p->size;\ + t_p->size = size;\ t_p->perm = malloc(size * sizeof(TYPE_SIZE_T));\ type *sorted_perm = malloc(size * sizeof(type));\ - COPY_ARRAY_##type(sorted_perm, p->perm, size);\ + COPY_ARRAY_##type(sorted_perm,(const type*)p->perm, size);\ qsort(sorted_perm, size, sizeof(type), COMPARE_N_##type);\ size_t *rec_index_visited = malloc(size * sizeof(size_t));\ size_t cur_rec = 0; bool found_rec;\ @@ -48,12 +49,17 @@ GENERATE_PERMUTATION_FUNCTIONS_UNSIGNED(TYPE_SIZE_T) if(rec_index_visited[k] == j){\ found_rec == true; break; } } \ if(found_rec == false){\ - t_p->perm[i] = j;\ + /*t_p->perm[i] = j;*/\ + t_p->perm[j] = i;\ rec_index_visited[cur_rec++] = j; \ - break; } } } } \ + break; }\ + }\ + }\ + }\ free(rec_index_visited);\ free(sorted_perm);\ - return t_p; }\ + return t_p; \ + }\ \ bool IS_PERMUTATION_##type(const PERMUTATION_##type *p){\ if(p == NULL) return false;\ diff --git a/src/permutation_t/permutation_t.h b/src/permutation_t/permutation_t.h index db4c7dd..6a5d8ef 100644 --- a/src/permutation_t/permutation_t.h +++ b/src/permutation_t/permutation_t.h @@ -17,16 +17,16 @@ \ typedef struct PERMUTATION_##type PERMUTATION_##type;\ PERMUTATION_##type * CREATE_PERMUTATION_##type(size_t size);\ +PERMUTATION_TYPE_SIZE_T * TRANSLATE_TO_SET_THEORIC_SIZE_T_##type(const PERMUTATION_##type *p );\ - +GENERATE_PERMUTATION(TYPE_SIZE_T) GENERATE_PERMUTATION(TYPE_CHAR) GENERATE_PERMUTATION(TYPE_U_CHAR) GENERATE_PERMUTATION(TYPE_INT) GENERATE_PERMUTATION(TYPE_U_INT) GENERATE_PERMUTATION(TYPE_L_INT) GENERATE_PERMUTATION(TYPE_U_L_INT) -GENERATE_PERMUTATION(TYPE_SIZE_T) GENERATE_PERMUTATION(TYPE_FLOAT) GENERATE_PERMUTATION(TYPE_DOUBLE) GENERATE_PERMUTATION(TYPE_L_DOUBLE) diff --git a/src/set_theoric_t/set_theoric_t.h b/src/set_theoric_t/set_theoric_t.h index 2fda0bb..12a0fea 100644 --- a/src/set_theoric_t/set_theoric_t.h +++ b/src/set_theoric_t/set_theoric_t.h @@ -11,7 +11,7 @@ type *set; \ }; \ typedef struct SET_THEORIC_##type SET_THEORIC_##type; \ - SET_THEORIC_##type * CREATE_SET_THEORIC_##type(TYPE_##type); \ + SET_THEORIC_##type * CREATE_SET_THEORIC_##type(size_t id/*TYPE_##type*/); \ bool IS_SET_THEORIC_##type(SET_THEORIC_##type *st); \ GENERATE_UNSIGNED_SET_THEORIC(TYPE_U_CHAR) diff --git a/src/test_t/is_good.c b/src/test_t/is_good.c index 445bad1..b77dbc5 100644 --- a/src/test_t/is_good.c +++ b/src/test_t/is_good.c @@ -11,43 +11,41 @@ #include "src/test_t/test_t.h" -//#include "src/permutation_t/permutation_t.h" +#include "src/permutation_t/permutation_t.h" + TEST(size_permutation2){ - printf("another size_permutation2 again\n"); + PRINTF("another size_permutation2 again\n"); ASSERT_TRUE(false); } TEST(size_permutation) { -/* PERMUTATION_TYPE_CHAR *p = CREATE_PERMUTATION_TYPE_CHAR(3); - printf(" size = %u \n",p->size); - if(p->size == 3) print_OK_with_msg_endl(" FF yeah GOOD test size passed "); - else print_KO_with_msg_endl("NOT GOOD test size not passed "); -*/ - printf("test size_permutation2\n"); + PRINTF(" size = %lu \n",p->size); + EXPECT_EQ(p->size, 3); + PRINTF("test size_permutation2\n"); } TEST(size_permutation2){ - printf("another size_permutation2 again false\n"); + PRINTF("another size_permutation2 again false\n"); bool val_bool = false; ASSERT_TRUE(val_bool); } TEST(size_permutation2) { - printf("test size_permutation2\n"); + PRINTF("test size_permutation2\n"); bool val_bool = true; ASSERT_FALSE(val_bool); /* PERMUTATION_TYPE_CHAR *p = CREATE_PERMUTATION_TYPE_CHAR(3); - printf(" size = %u \n",p->size); + PRINTF(" size = %u \n",p->size); if(p->size == 3) print_OK_with_msg_endl(" FF yeah GOOD test size passed "); else print_KO_with_msg_endl("NOT GOOD test size not passed "); */ } TEST(float_equal){ - printf("another size_permutation2 float\n"); + PRINTF("another size_permutation2 float\n"); ASSERT_TRUE(true); float a = 1.00001f; float b = 1.00001f; @@ -57,7 +55,7 @@ TEST(float_equal){ ASSERT_EQ_TYPE_FLOAT(1.0000102f,b); } TEST(double_equal){ - printf("another size_permutation2 double\n"); + PRINTF("another size_permutation2 double\n"); ASSERT_TRUE(true); double a = 1.00000001; double b = 1.00000001; @@ -100,20 +98,32 @@ TEST(expect){ } TEST(){ - printf("no test, only print\n"); + PRINTF("no test, only print\n"); } TEST(){ - printf("no test, only print\n"); + PRINTF("no test, only print\n"); } TEST(){ - printf("no test, only print\n"); + PRINTF("no test, only print\n"); } TEST(){ - printf("no test, only print\n"); + + PERMUTATION_TYPE_CHAR *p_char = CREATE_PERMUTATION_TYPE_CHAR(6); + p_char->perm[0]='B'; + p_char->perm[1]='A'; + p_char->perm[2]='Y'; + p_char->perm[3]='C'; + p_char->perm[4]='D'; + p_char->perm[5]='Z'; + + PERMUTATION_TYPE_SIZE_T *tr_p_char = TRANSLATE_TO_SET_THEORIC_SIZE_T_TYPE_CHAR(p_char); + + for(int i = 0; i < tr_p_char->size; ++i) PRINTF(" [%d ]%ld ,",i,tr_p_char->perm[i]); + PRINTF("p_char == %s\n",p_char->perm); } TEST(lessThan){ diff --git a/src/test_t/test_t.c b/src/test_t/test_t.c index 7180008..af2cf46 100644 --- a/src/test_t/test_t.c +++ b/src/test_t/test_t.c @@ -27,6 +27,8 @@ #endif + + #if 0 #ifndef PARALLEL #define PARALLEL 1 @@ -70,6 +72,8 @@ struct failed_lists{ */ bool is_parallel = 0; +FILE **f_ou_th; + size_t count_tests = 0; size_t count_pass_global = 0; @@ -174,7 +178,7 @@ void append_failed_list(struct failed_lists **fn_failed_list ,const char *name_f */ long int id_of_thread_executed(void){ size_t id_from_self = pthread_self(); - for(size_t i=0; i