status_helpers.h 1.26 KB
Newer Older
1 2 3 4
#ifndef INCLUDE_cl_status_helpers_h__
#define INCLUDE_cl_status_helpers_h__

typedef struct {
5 6 7
	int wrong_status_flags_count;
	int wrong_sorted_path;
	int entry_count;
8 9
	const unsigned int* expected_statuses;
	const char** expected_paths;
10
	int expected_entry_count;
11
	const char *file;
12
	const char *func;
13
	int line;
14
	bool debug;
15 16
} status_entry_counts;

17 18 19 20 21
#define status_counts_init(counts, paths, statuses) do { \
	memset(&(counts), 0, sizeof(counts)); \
	(counts).expected_statuses = (statuses); \
	(counts).expected_paths = (paths); \
	(counts).file = __FILE__; \
22
	(counts).func = __func__; \
23 24 25
	(counts).line = __LINE__; \
	} while (0)

26 27 28 29 30 31 32 33 34 35 36 37 38 39
/* cb_status__normal takes payload of "status_entry_counts *" */

extern int cb_status__normal(
	const char *path, unsigned int status_flags, void *payload);


/* cb_status__count takes payload of "int *" */

extern int cb_status__count(const char *p, unsigned int s, void *payload);


typedef struct {
	int count;
	unsigned int status;
40
	bool debug;
41 42 43 44 45 46
} status_entry_single;

/* cb_status__single takes payload of "status_entry_single *" */

extern int cb_status__single(const char *p, unsigned int s, void *payload);

47 48 49 50
/* cb_status__print takes optional payload of "int *" */

extern int cb_status__print(const char *p, unsigned int s, void *payload);

51
#endif