From 283effb16646112ee9c6bba57e021e80f322b29f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Fri, 4 Oct 2024 14:29:00 +0200 Subject: Avoid repeating typedefs in tests --- test/090_tables_readwrite/tables_readwrite_tests.c | 20 --------------- test/100_gendata_cocsep/gendata_cocsep_tests.c | 21 ---------------- .../cocsep_transform_invariant.c | 6 ----- test/102_cocsep_selfsim/cocsep_selfsim_tests.c | 3 --- .../cocsep_selfsim_distribution_tests.c | 5 +--- test/104_cocsep_ttrep/cocsep_ttrep_tests.c | 10 ++------ .../coord_invcoord_h48_tests.c | 3 --- test/111_h48map/h48map_tests.c | 13 ---------- test/112_gendata_h48short/gendata_h48short_tests.c | 29 +--------------------- test/test.h | 5 ++++ 10 files changed, 9 insertions(+), 106 deletions(-) (limited to 'test') diff --git a/test/090_tables_readwrite/tables_readwrite_tests.c b/test/090_tables_readwrite/tables_readwrite_tests.c index 73c4e21..9238207 100644 --- a/test/090_tables_readwrite/tables_readwrite_tests.c +++ b/test/090_tables_readwrite/tables_readwrite_tests.c @@ -1,25 +1,5 @@ #include "../test.h" -#define INFOSIZE 512 -#define INFO_SOLVER_STRLEN 100 -#define INFO_DISTRIBUTION_LEN 21 - -typedef struct { - uint64_t distribution[INFO_DISTRIBUTION_LEN]; - uint64_t type; - uint64_t infosize; - uint64_t fullsize; - uint64_t hash; - uint64_t entries; - uint64_t classes; - uint64_t next; - char solver[INFO_SOLVER_STRLEN]; - uint8_t h48h; - uint8_t bits; - uint8_t base; - uint8_t maxvalue; -} tableinfo_t; - bool readtableinfo(const void *, tableinfo_t *); bool writetableinfo(const tableinfo_t *, void *); diff --git a/test/100_gendata_cocsep/gendata_cocsep_tests.c b/test/100_gendata_cocsep/gendata_cocsep_tests.c index 62f52fb..296df28 100644 --- a/test/100_gendata_cocsep/gendata_cocsep_tests.c +++ b/test/100_gendata_cocsep/gendata_cocsep_tests.c @@ -1,26 +1,5 @@ #include "../test.h" -#define INFOSIZE 512 -#define INFO_SOLVER_STRLEN 100 -#define INFO_DISTRIBUTION_LEN 21 -#define COCSEP_CLASSES 3393 - -typedef struct { - uint64_t distribution[INFO_DISTRIBUTION_LEN]; - uint64_t type; - uint64_t infosize; - uint64_t fullsize; - uint64_t hash; - uint64_t entries; - uint64_t classes; /* Used only by cocsepdata, for now */ - uint64_t next; - char solver[INFO_SOLVER_STRLEN]; - uint8_t h48h; - uint8_t bits; - uint8_t base; - uint8_t maxvalue; -} tableinfo_t; - size_t gendata_cocsep(void *, uint64_t *, cube_t *); bool readtableinfo(const void *, tableinfo_t *); diff --git a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c index 67f70a5..853586a 100644 --- a/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c +++ b/test/101_cocsep_transform_invariant/cocsep_transform_invariant.c @@ -1,11 +1,5 @@ #include "../test.h" -#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) -#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16)) - -#define INFOSIZE 512 -#define COCSEP_CLASSES 3393 - size_t gendata_cocsep(void *, uint64_t *, cube_t *); cube_t transform(cube_t, uint8_t); int64_t coord_cocsep(cube_t); diff --git a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c index 490952a..dd778aa 100644 --- a/test/102_cocsep_selfsim/cocsep_selfsim_tests.c +++ b/test/102_cocsep_selfsim/cocsep_selfsim_tests.c @@ -7,9 +7,6 @@ */ #include "../test.h" -#define COCSEP_CLASSES 3393 -#define INFOSIZE 512 - size_t gendata_cocsep(void *, uint64_t *, cube_t *); int64_t coord_cocsep(cube_t); diff --git a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c index 84e3fd8..a907317 100644 --- a/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c +++ b/test/103_cocsep_selfsim_distribution/cocsep_selfsim_distribution_tests.c @@ -1,7 +1,5 @@ #include "../test.h" -#define COCSEP_CLASSES 3393 - size_t gendata_cocsep(void *, uint64_t *, cube_t *); int64_t coord_cocsep(cube_t); @@ -19,8 +17,7 @@ int bcount(uint64_t x) { void run(void) { char buf[2000000]; int size[65], tot, j; - int64_t i; - uint64_t selfsim[COCSEP_CLASSES], sim; + uint64_t i, selfsim[COCSEP_CLASSES], sim; cube_t rep[COCSEP_CLASSES]; memset(size, 0, 65 * sizeof(int)); diff --git a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c index efe5a26..0b853c3 100644 --- a/test/104_cocsep_ttrep/cocsep_ttrep_tests.c +++ b/test/104_cocsep_ttrep/cocsep_ttrep_tests.c @@ -1,11 +1,5 @@ #include "../test.h" -#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) -#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) - -#define COCSEP_CLASSES 3393 -#define INFOSIZE 512 - uint8_t inverse_trans(uint8_t); cube_t transform_corners(cube_t, uint8_t); int64_t coord_cocsep(cube_t); @@ -15,8 +9,8 @@ void run(void) { uint8_t t; char buf[2000000]; uint32_t *cocsepdata, tt; - uint64_t selfsim[COCSEP_CLASSES]; - int64_t i, j, k, l; + uint64_t i, selfsim[COCSEP_CLASSES]; + int64_t j, k, l; cube_t rep[COCSEP_CLASSES], c, d; gendata_cocsep(buf, selfsim, rep); diff --git a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c index 1fcbabd..025ff2b 100644 --- a/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c +++ b/test/110_coord_invcoord_h48/coord_invcoord_h48_tests.c @@ -1,8 +1,5 @@ #include "../test.h" -#define COCSEP_CLASSES 3393 -#define INFOSIZE 512 - size_t gendata_cocsep(void *, uint64_t *, cube_t *); int64_t coord_h48(cube_t, const uint32_t *, uint8_t); cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); diff --git a/test/111_h48map/h48map_tests.c b/test/111_h48map/h48map_tests.c index d70bc3a..7fdfb3d 100644 --- a/test/111_h48map/h48map_tests.c +++ b/test/111_h48map/h48map_tests.c @@ -1,20 +1,7 @@ #include "../test.h" -#define MAP_KEYSHIFT UINT64_C(40) #define MAXPOS 1000 -typedef struct { - uint64_t n; - uint64_t capacity; - uint64_t randomizer; - uint64_t *table; -} h48map_t; - -typedef struct { - uint64_t key; - uint64_t val; -} kvpair_t; - void h48map_create(h48map_t *, uint64_t, uint64_t); void h48map_destroy(h48map_t *); void h48map_insertmin(h48map_t *, uint64_t, uint64_t); diff --git a/test/112_gendata_h48short/gendata_h48short_tests.c b/test/112_gendata_h48short/gendata_h48short_tests.c index fb432d3..b6ff00e 100644 --- a/test/112_gendata_h48short/gendata_h48short_tests.c +++ b/test/112_gendata_h48short/gendata_h48short_tests.c @@ -1,33 +1,6 @@ #include "../test.h" -#define COCSEP_CLASSES 3393 -#define INFOSIZE 512 -#define MAXPOS 200 - -typedef struct { - uint64_t n; - uint64_t capacity; - uint64_t randomizer; - uint64_t *table; - uint32_t *info; - uint32_t *cocsepdata; - uint32_t *h48data; - uint64_t selfsim[COCSEP_CLASSES]; - cube_t crep[COCSEP_CLASSES]; -} h48map_t; - -typedef struct { - uint64_t key; - uint64_t val; -} kvpair_t; - -typedef struct { - uint8_t maxdepth; - const uint32_t *cocsepdata; - const cube_t *crep; - const uint64_t *selfsim; - h48map_t *map; -} gendata_h48short_arg_t; +#define MAXPOS 200 void h48map_create(h48map_t *, uint64_t, uint64_t); void h48map_destroy(h48map_t *); diff --git a/test/test.h b/test/test.h index d7658cb..b90a399 100644 --- a/test/test.h +++ b/test/test.h @@ -1,6 +1,7 @@ #define TEST_H #include +#include #include #include #include @@ -8,6 +9,10 @@ #include #include "../src/arch/arch.h" +#include "../src/solvers/tables_types_macros.h" +#include "../src/solvers/h48/coordinate_macros.h" +#include "../src/solvers/h48/map_types_macros.h" +#include "../src/solvers/h48/gendata_types_macros.h" #define STRLENMAX 10000 -- cgit v1.3