re-implemented test using new convenience functions
This commit is contained in:
32
test/util.h
32
test/util.h
@@ -19,10 +19,7 @@
|
||||
|
||||
*/
|
||||
|
||||
#define STR_BUF_SIZE 256 // buffer size for constructing arbitrary strings
|
||||
|
||||
#define decl_test(n) static TestResult n(TestState *)
|
||||
#define def_test(n, s) static TestResult n(TestState *s)
|
||||
#define STR_BUF_SIZE 256 // maximum string buffer size
|
||||
|
||||
// initializes a sample TestState value
|
||||
void mk_sample_state(TestState *);
|
||||
@@ -30,40 +27,39 @@ void mk_sample_state(TestState *);
|
||||
// ensures two TestState values are equal
|
||||
extern void chk_TestState_eq(
|
||||
TestState *, // the state we are *actually* updating ;)
|
||||
const char *, // prefix for each status line
|
||||
const char *, // context for errors
|
||||
const char *, // the context
|
||||
const TestState *, // actual state
|
||||
const TestState * // expected state
|
||||
);
|
||||
|
||||
// ensure two integers are equal
|
||||
extern void chk_int_eq(
|
||||
TestState *,
|
||||
const char *, // the error context
|
||||
TestState *, // the test state
|
||||
const char *, // the context
|
||||
int, // the actual value
|
||||
int // the expected value
|
||||
);
|
||||
|
||||
// ensure two pointers are equal
|
||||
extern void chk_ptr_eq(
|
||||
TestState *,
|
||||
const char *, // the error context
|
||||
const void *, // the actual value
|
||||
const void * // the expected value
|
||||
TestState *, // the test state
|
||||
const char *, // the context
|
||||
void *, // the actual value
|
||||
void * // the expected value
|
||||
);
|
||||
|
||||
// ensure two pointers are not equal
|
||||
extern void chk_ptr_ne(
|
||||
TestState *,
|
||||
const char *, // the error context
|
||||
const void *, // the actual value
|
||||
const void * // the prohibited value
|
||||
TestState *, // the test state
|
||||
const char *, // the context
|
||||
void *, // the actual value
|
||||
void * // the prohibited value
|
||||
);
|
||||
|
||||
// ensure two strings are equal
|
||||
extern void chk_str_eq(
|
||||
TestState *,
|
||||
const char *, // the error context
|
||||
TestState *, // the test state
|
||||
const char *, // the context
|
||||
const char *, // the actual value
|
||||
const char * // the expected value
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user