Permalink
Browse files

matchers: rename neq,leq,geq to ne,le,ge

2-character comparison matchers are more in-line with the others: eq,
lt, gt.

This is also to be somewhat consistent with the new Criterion assert API.
  • Loading branch information...
Snaipe committed Jul 13, 2017
1 parent e4e6d1f commit 15cf059db7e5142943ba3aba994cb36ad432a631
Showing with 10 additions and 10 deletions.
  1. +3 −3 include/mimick.h
  2. +6 −6 include/mimick/matcher.h
  3. +1 −1 sample/strdup/test.c
@@ -279,7 +279,7 @@ void mmk_stub_destroy(mmk_stub stub);
* @param[in] Type The type of the value to match.
* @param[in] Val The reference to compare values with.
*/
# define mmk_neq(Type, Val) <internal>
# define mmk_ne(Type, Val) <internal>

/**
* Match any value strictly lower than `Val`.
@@ -295,7 +295,7 @@ void mmk_stub_destroy(mmk_stub stub);
* @param[in] Type The type of the value to match.
* @param[in] Val The reference to compare values with.
*/
# define mmk_leq(Type, Val) <internal>
# define mmk_le(Type, Val) <internal>

/**
* Match any value strictly greater than `Val`.
@@ -311,7 +311,7 @@ void mmk_stub_destroy(mmk_stub stub);
* @param[in] Type The type of the value to match.
* @param[in] Val The reference to compare values with.
*/
# define mmk_geq(Type, Val) <internal>
# define mmk_ge(Type, Val) <internal>

/**
* Match any value accepted by a predicate.
@@ -64,16 +64,16 @@ struct mmk_matcher {
# define mmk_any(Type) mmk_matcher_val_(MMK_MATCHER_ANY, Type, { 0 })
# undef mmk_eq
# define mmk_eq(Type, Val) mmk_matcher_val_(MMK_MATCHER_EQ, Type, Val)
# undef mmk_neq
# define mmk_neq(Type, Val) mmk_matcher_val_(MMK_MATCHER_NEQ, Type, Val)
# undef mmk_ne
# define mmk_ne(Type, Val) mmk_matcher_val_(MMK_MATCHER_NEQ, Type, Val)
# undef mmk_lt
# define mmk_lt(Type, Val) mmk_matcher_val_(MMK_MATCHER_LT, Type, Val)
# undef mmk_leq
# define mmk_leq(Type, Val) mmk_matcher_val_(MMK_MATCHER_LEQ, Type, Val)
# undef mmk_le
# define mmk_le(Type, Val) mmk_matcher_val_(MMK_MATCHER_LEQ, Type, Val)
# undef mmk_gt
# define mmk_gt(Type, Val) mmk_matcher_val_(MMK_MATCHER_GT, Type, Val)
# undef mmk_geq
# define mmk_geq(Type, Val) mmk_matcher_val_(MMK_MATCHER_GEQ, Type, Val)
# undef mmk_ge
# define mmk_ge(Type, Val) mmk_matcher_val_(MMK_MATCHER_GEQ, Type, Val)
# undef mmk_that
# define mmk_that(Predicate) ((struct mmk_matcher *) &(struct { struct mmk_matcher matcher; void (*val)(void); }) { .val = (void (*)(void)) Predicate })

@@ -20,7 +20,7 @@ void test_simple_case(void)

/* mmk_verify is overkill in this case, mmk_verify should be used when you
* care about testing interactions rather than external behaviour */
int pass = mmk_verify(malloc(mmk_geq(size_t, sizeof (ref))), .times = 1);
int pass = mmk_verify(malloc(mmk_ge(size_t, sizeof (ref))), .times = 1);

mmk_assert(pass);
mmk_assert(dup == buf && !strcmp(ref, buf));

0 comments on commit 15cf059

Please sign in to comment.