mmk_when
there's
mmk_when (malloc, m,
.with_size = mmk_eq(size_t, sizeof (ref)),
.then_return = buf);
of course, but
mmk_when (m, malloc(sizeof (ref)), .then_return = buf);
seems really attractive
mmk_when (m, foo(1, mmk_lt(0), mmk_arg_that(is_valid)), .then_return = 42);
mmk_verify
lets you check the number of times a function has been called based on predicates
mmk_when
vs mmk_verify
?
mmk_verify
asserts that at some point the function has been called with matching parameters a certain number of times
mmk_when
(i.e. you tell a function to do things)
mmk_verify
mmk_verify
without mmk_when
, and mmk_verify
without mmk_when
(useful when you don't care about return values)
.with_foo = 42
instead of .with_foo = mmk_eq(type, 42)
mmk_any(type)
, which produces a dummy value matching any parameter
mmk_lt(type, val)
, which produces a dummy value matching any parameter less than val
test_stats_init
)