From b2f005239b34d61338954012803c784f7bd6e1e4 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sun, 15 Jul 2018 10:54:38 +0200 Subject: [PATCH] API breakage: rename _constains into _contain_p to be more uniform with other predicate functions, and to use infinitive form for the method. --- doc/API.txt | 2 ++ m-algo.h | 2 +- tests/test-malgo.c | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/API.txt b/doc/API.txt index 29cf7c7b..4acf97d8 100644 --- a/doc/API.txt +++ b/doc/API.txt @@ -16,5 +16,7 @@ V0.2.*: * worker_sync takes a 'worker_t' as an additional parameter Since there is no key, it is a push method, not a _set_at method. * DICT_SET_DEF2 ==> DICT_SET_DEF since it only requires one argument. + * ALGO _contains ==> _contain_p + since it is a predicate '_p' and it shall be in infinitive form. diff --git a/m-algo.h b/m-algo.h index f94e6e5e..7a430931 100644 --- a/m-algo.h +++ b/m-algo.h @@ -103,7 +103,7 @@ } \ \ static inline bool \ - M_C(name, _contains) (container_t l, type_t const data) \ + M_C(name, _contain_p) (container_t l, type_t const data) \ { \ it_t it; \ M_C(name,_find)(it, l, data); \ diff --git a/tests/test-malgo.c b/tests/test-malgo.c index 522bd890..105fa821 100644 --- a/tests/test-malgo.c +++ b/tests/test-malgo.c @@ -92,8 +92,8 @@ static void test_list(void) list_int_init(l); for(int i = 0; i < 100; i++) list_int_push_back (l, i); - assert( algo_list_contains(l, 62) == true); - assert( algo_list_contains(l, -1) == false); + assert( algo_list_contain_p(l, 62) == true); + assert( algo_list_contain_p(l, -1) == false); assert( algo_list_count(l, 1) == 1); list_int_push_back (l, 17); @@ -158,8 +158,8 @@ static void test_array(void) array_int_init(l); for(int i = 0; i < 100; i++) array_int_push_back (l, i); - assert( algo_array_contains(l, 62) == true); - assert( algo_array_contains(l, -1) == false); + assert( algo_array_contain_p(l, 62) == true); + assert( algo_array_contain_p(l, -1) == false); assert( algo_array_sort_p(l) == true); assert( algo_array_count(l, 1) == 1);