From 52fa6ff65b43b821401dbbe182667bbae963154b Mon Sep 17 00:00:00 2001 From: Hugo LAMY Date: Sat, 2 Jul 2022 18:30:27 +0200 Subject: [PATCH] all broken --- Makefile | 6 +++--- tests/includes/tests_utils.hpp | 21 ++++++++++++--------- tests/includes/tests_vector.hpp | 5 +++++ tests/tests_stack.cpp | 12 ++++++------ tests/tests_vector.cpp | 1 + 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 6384635..219c2e5 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,9 @@ CC = c++ EXT = cpp CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -#CFLAGS += -std=c++98 -#CFLAGS += -MMD -MP #see end-page note on header dependencie -#CFLAGS += -g3 +CFLAGS += -std=c++98 +CFLAGS += -MMD -MP #see end-page note on header dependencie +CFLAGS += -g3 CFLAGS_STL = $(CFLAGS) CFLAGS_STL += -D STL diff --git a/tests/includes/tests_utils.hpp b/tests/includes/tests_utils.hpp index 446bd28..314fb9c 100644 --- a/tests/includes/tests_utils.hpp +++ b/tests/includes/tests_utils.hpp @@ -20,13 +20,14 @@ // defines // **************************************** -# define TITLE(s) std::cout << "\n" B_PURPLE #s RESET "\n\n"; -# define VAL(n) val(n) -# define VALT(n) val(n) -# define VALU(n) val(n) -# define TOI(n) toi(n) -# define PRINT(n) print<>(n, #n); -# define DELETE delete_structs(); +# define TITLE(s) std::cout << "\n" B_PURPLE #s RESET "\n\n"; +# define VAL(n) val(n) +# define VALT(n) val(n) +# define VALU(n) val(n) +# define TOI(n) toi(n) +# define PRINT(n) print<>(n, #n); +# define DELETE delete_structs(); +# define DISALLOW_MYSTRUCT allow_mystruct = 0; // prototypes @@ -43,7 +44,7 @@ extern std::vector< mystruct* > mem_list; // adding each test to the list // *************************** -#define TEST(f_name) TEST_V(f_name) +#define TEST_S(f_name) TEST_V(f_name) /* */ @@ -56,7 +57,9 @@ extern std::vector< mystruct* > mem_list; add_to_list(#f_name, "int", new(s_ ## f_name ));\ add_to_list(#f_name, "char", new(s_ ## f_name ));\ add_to_list(#f_name, "std::string", new(s_ ## f_name ));\ - add_to_list(#f_name, "mystruct*", new(s_ ## f_name ));\ + if (allow_mystruct)\ + add_to_list(#f_name, "mystruct*", new(s_ ## f_name ));\ + allow_mystruct = 1;\ }\ template \ void s_ ## f_name ::func() diff --git a/tests/includes/tests_vector.hpp b/tests/includes/tests_vector.hpp index 5da7c7a..0888b99 100644 --- a/tests/includes/tests_vector.hpp +++ b/tests/includes/tests_vector.hpp @@ -14,6 +14,11 @@ #endif +// global variables +// **************************************** +int allow_mystruct = 1; + + // templates print // ***************************************** template diff --git a/tests/tests_stack.cpp b/tests/tests_stack.cpp index 712bfa1..35f0cc3 100644 --- a/tests/tests_stack.cpp +++ b/tests/tests_stack.cpp @@ -7,7 +7,7 @@ #define DEQ_VEC vector #endif -TEST(tests_stack_constructor) +TEST_S(tests_stack_constructor) { // title TITLE(simple test) @@ -34,7 +34,7 @@ TEST(tests_stack_constructor) DELETE } -TEST(tests_stack_empty) +TEST_S(tests_stack_empty) { // title TITLE(simple test) @@ -57,7 +57,7 @@ TEST(tests_stack_empty) DELETE } -TEST(tests_stack_size) +TEST_S(tests_stack_size) { // title TITLE(simple test) @@ -76,7 +76,7 @@ TEST(tests_stack_size) DELETE } -TEST(tests_stack_top) +TEST_S(tests_stack_top) { // title TITLE(simple test) @@ -100,7 +100,7 @@ TEST(tests_stack_top) DELETE } -TEST(tests_stack_push) +TEST_S(tests_stack_push) { // title TITLE(simple test) @@ -114,7 +114,7 @@ TEST(tests_stack_push) DELETE } -TEST(tests_stack_pop) +TEST_S(tests_stack_pop) { // title TITLE(simple test) diff --git a/tests/tests_vector.cpp b/tests/tests_vector.cpp index bcb83e2..d6e96a6 100644 --- a/tests/tests_vector.cpp +++ b/tests/tests_vector.cpp @@ -695,6 +695,7 @@ TEST_V(tests_vector_get_allocator) DELETE } +//DISALLOW_MYSTRUCT TEST_V(tests_vector_relational_operators) { // title