attr_expect.h 748 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#ifndef __CLAR_TEST_ATTR_EXPECT__
#define __CLAR_TEST_ATTR_EXPECT__

enum attr_expect_t {
	EXPECT_FALSE,
	EXPECT_TRUE,
	EXPECT_UNDEFINED,
	EXPECT_STRING
};

struct attr_expected {
	const char *path;
	const char *attr;
	enum attr_expect_t expected;
	const char *expected_str;
};

18
GIT_INLINE(void) attr_check_expected(
19 20
	enum attr_expect_t expected,
	const char *expected_str,
21
	const char *name,
22 23 24 25
	const char *value)
{
	switch (expected) {
	case EXPECT_TRUE:
26
		cl_assert_(GIT_ATTR_TRUE(value), name);
27 28 29
		break;

	case EXPECT_FALSE:
30
		cl_assert_(GIT_ATTR_FALSE(value), name);
31 32 33
		break;

	case EXPECT_UNDEFINED:
34
		cl_assert_(GIT_ATTR_UNSPECIFIED(value), name);
35 36 37
		break;

	case EXPECT_STRING:
38
		cl_assert_equal_s(expected_str, value);
39 40 41 42 43
		break;
	}
}

#endif