ocarina/include/tests/test.h

23 lines
514 B
C

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#ifndef OCARINA_TESTS_TEST_H
#define OCARINA_TESTS_TEST_H
#include <glib.h>
/*
* Compares two strings, and frees lhs before returning.
* NOTE: We store lhs in a temporary string so that "lhs" only gets
* evaluated once in the case that it is a function.
*/
#define g_assert_cmpstr_free(lhs, cmp, rhs) \
do { \
gchar *__tmp_str = lhs; \
g_assert_cmpstr(__tmp_str, cmp, rhs); \
g_free(__tmp_str); \
} while (0)
#endif /* OCARINA_TESTS_TEST_H */