r20768 - gnucash/trunk/src - Add unit test utility macros
John Ralls
jralls at code.gnucash.org
Sat Jun 18 19:20:20 EDT 2011
Author: jralls
Date: 2011-06-18 19:20:20 -0400 (Sat, 18 Jun 2011)
New Revision: 20768
Trac: http://svn.gnucash.org/trac/changeset/20768
Modified:
gnucash/trunk/src/libqof/qof/test/Makefile.am
gnucash/trunk/src/test-core/test-stuff.h
Log:
Add unit test utility macros
Modified: gnucash/trunk/src/libqof/qof/test/Makefile.am
===================================================================
--- gnucash/trunk/src/libqof/qof/test/Makefile.am 2011-06-18 15:18:22 UTC (rev 20767)
+++ gnucash/trunk/src/libqof/qof/test/Makefile.am 2011-06-18 23:20:20 UTC (rev 20768)
@@ -30,5 +30,6 @@
test_qof_CFLAGS = \
${DEFAULT_INCLUDES} \
-I$(top_srcdir)/${MODULEPATH}/ \
+ -I$(top_srcdir)/src/test-core \
-DTESTPROG=test_qof \
${GLIB_CFLAGS}
Modified: gnucash/trunk/src/test-core/test-stuff.h
===================================================================
--- gnucash/trunk/src/test-core/test-stuff.h 2011-06-18 15:18:22 UTC (rev 20767)
+++ gnucash/trunk/src/test-core/test-stuff.h 2011-06-18 23:20:20 UTC (rev 20768)
@@ -53,6 +53,30 @@
#define do_test_args( result, title, format ) do_test_call( result, title, __FILE__, __LINE__, format, ... );
*/
+/**
+ * Use this macro to format informative test path output when using g_test_add.
+ * Suite stands for tests' pack, while path for individual test name.
+*/
+
+#define GNC_TEST_ADD( suite, path, fixture, data, setup, test, teardown )\
+{\
+ gchar *testpath = g_strdup_printf( "%s/%s", suite, path );\
+ g_test_add( testpath, fixture, NULL, setup, test, teardown );\
+ g_free( testpath );\
+}
+
+/**
+ * Use this macro to format informative test path output when using g_test_add_func.
+ * Suite stands for tests' pack, while path for individual test name.
+*/
+
+#define GNC_TEST_ADD_FUNC( suite, path, test )\
+{\
+ gchar *testpath = g_strdup_printf( "%s/%s", suite, path );\
+ g_test_add_func( testpath, test );\
+ g_free( testpath );\
+}
+
/* Privately used to indicate a test result. You may use these if you
* wish, but it's easier to use the do_test macro above.
*/
More information about the gnucash-changes
mailing list