diff options
author | Colin Walters <walters@verbum.org> | 2014-12-17 20:52:24 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2014-12-17 20:52:24 -0500 |
commit | 70c019db163b3a6d23d2efefa682daeab3b7a61f (patch) | |
tree | 1e7edec9229637979c83caa5c9f7d0c243a11929 /tests/localalloc.c | |
parent | 012bdf72eceda33d430284161231884c348c8081 (diff) | |
download | libgsystem-70c019db163b3a6d23d2efefa682daeab3b7a61f.tar.gz |
tests: Add a localalloc test
Diffstat (limited to 'tests/localalloc.c')
-rw-r--r-- | tests/localalloc.c | 39 |
1 files changed, 39 insertions, 0 deletions
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 <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include <libgsystem.h> +#include <glib-unix.h> + +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 (); +} |