libs/gst/check/gstcheck.*: create a macro and function so that the simple unit test case can be just one macro to cre...

Original commit message from CVS:
* libs/gst/check/gstcheck.c: (gst_check_run_suite):
* libs/gst/check/gstcheck.h:
create a macro and function so that the simple unit test
case can be just one macro to create main()
This commit is contained in:
Thomas Vander Stichele 2006-07-01 20:54:25 +00:00
parent 565199efa8
commit 374b55af56
4 changed files with 37 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2006-07-01 Thomas Vander Stichele <thomas at apestaart dot org>
* libs/gst/check/gstcheck.c: (gst_check_run_suite):
* libs/gst/check/gstcheck.h:
create a macro and function so that the simple unit test
case can be just one macro to create main()
2006-06-30 Tim-Philipp Müller <tim at centricular dot net> 2006-06-30 Tim-Philipp Müller <tim at centricular dot net>
* gst/gstbin.c: (gst_bin_restore_thyself): * gst/gstbin.c: (gst_bin_restore_thyself):

2
common

@ -1 +1 @@
Subproject commit 123195d3bbcc0b6e1cf867d3a180685f8766a0be Subproject commit f4348ab157cc5e859f287e746004c0210880969a

View file

@ -2,7 +2,7 @@
* *
* Common code for GStreamer unittests * Common code for GStreamer unittests
* *
* Copyright (C) <2004> Thomas Vander Stichele <thomas at apestaart dot org> * Copyright (C) 2004,2006 Thomas Vander Stichele <thomas at apestaart dot org>
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
@ -292,3 +292,23 @@ gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes)
} }
} }
} }
gint
gst_check_run_suite (Suite * suite, const gchar * name, const gchar * fname)
{
gint nf;
SRunner *sr = srunner_create (suite);
if (g_getenv ("GST_CHECK_XML")) {
/* how lucky we are to have __FILE__ end in .c */
gchar *xmlfilename = g_strdup_printf ("%sheck.xml", fname);
srunner_set_xml (sr, xmlfilename);
}
srunner_run_all (sr, CK_NORMAL);
nf = srunner_ntests_failed (sr);
srunner_free (sr);
return nf;
}

View file

@ -73,8 +73,7 @@ GstPad * gst_check_setup_sink_pad (GstElement *element,
GstStaticPadTemplate *template, GstCaps *caps); GstStaticPadTemplate *template, GstCaps *caps);
void gst_check_teardown_sink_pad (GstElement *element); void gst_check_teardown_sink_pad (GstElement *element);
void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes); void gst_check_abi_list (GstCheckABIStruct list[], gboolean have_abi_sizes);
gint gst_check_run_suite (Suite *suite, const gchar *name, const gchar *fname);
#define fail_unless_message_error(msg, domain, code) \ #define fail_unless_message_error(msg, domain, code) \
gst_check_message_error (msg, GST_MESSAGE_ERROR, \ gst_check_message_error (msg, GST_MESSAGE_ERROR, \
@ -277,3 +276,10 @@ fail_unless (gst_element_set_state (element, \
#endif /* __GST_CHECK_H__ */ #endif /* __GST_CHECK_H__ */
#define GST_CHECK_MAIN(name) \
int main (int argc, char **argv) \
{ \
Suite *s = name ## _suite (); \
gst_check_init (&argc, &argv); \
return gst_check_run_suite (s, # name, __FILE__); \
}