From 70c019db163b3a6d23d2efefa682daeab3b7a61f Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 17 Dec 2014 20:52:24 -0500 Subject: tests: Add a localalloc test --- Makefile-tests.am | 5 +++++ tests/localalloc.c | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 tests/localalloc.c diff --git a/Makefile-tests.am b/Makefile-tests.am index 7f4fe83..f4ead89 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -4,6 +4,11 @@ tests_shutil_CPPFLAGS = -I $(srcdir)/src tests_shutil_CFLAGS = $(BUILDDEP_GIO_UNIX_CFLAGS) tests_shutil_LDADD = $(BUILDDEP_GIO_UNIX_LIBS) libgsystem.la +tests_localalloc_CPPFLAGS = -I $(srcdir)/src +tests_localalloc_CFLAGS = $(BUILDDEP_GIO_UNIX_CFLAGS) +tests_localalloc_LDADD = $(BUILDDEP_GIO_UNIX_LIBS) libgsystem.la + test_programs = \ tests/shutil \ + tests/localalloc \ $(NULL) diff --git a/tests/localalloc.c b/tests/localalloc.c new file mode 100644 index 0000000..46024c3 --- /dev/null +++ b/tests/localalloc.c @@ -0,0 +1,39 @@ +#include +#include +#include + +#include +#include + +static void +test_localalloc (void) +{ + gs_free char *str = g_strdup ("str"); + gs_free char *nullstr = NULL; + gs_unref_object GFile *obj = g_file_new_for_path ("obj"); + gs_unref_object GFile *nullobj = NULL; + gs_unref_variant GVariant *v = g_variant_new_strv (NULL, 0); + gs_free_variant_iter GVariantIter *viter = g_variant_iter_new (v); + gs_unref_variant_builder GVariantBuilder *vbuilder = g_variant_builder_new (G_VARIANT_TYPE("a{sv}")); + gs_unref_array GArray *arr = g_array_new (TRUE, FALSE, 42); + gs_unref_ptrarray GPtrArray *parr = g_ptr_array_new (); + gs_unref_hashtable GHashTable *hash = g_hash_table_new (NULL, NULL); + gs_free_list GList *list = g_list_append (NULL, (gpointer)42); + gs_free_slist GSList *slist = g_slist_append (NULL, (gpointer)42); + gs_free_checksum GChecksum *csum = g_checksum_new (G_CHECKSUM_SHA256); + gs_unref_bytes GBytes *bytes = g_bytes_new ("hello", 5); + gs_strfreev char **strv = g_get_environ (); + gs_free_error GError *err = g_error_new (G_IO_ERROR, G_IO_ERROR_FAILED, "oops %s", "darn!"); + gs_unref_keyfile GKeyFile *keyfile = g_key_file_new (); +} + +int +main (int argc, + char *argv[]) +{ + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/localalloc/all", test_localalloc); + + return g_test_run (); +} -- cgit v1.2.1