diff options
author | Yi-Soo An <yisooan@gmail.com> | 2018-07-24 14:07:16 +0900 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2018-10-31 15:43:52 +0100 |
commit | 4f381aaa7937c8d378dc8a7e93bbd999a8873373 (patch) | |
tree | 2e5435f9501f1b6dcf88f2127b3ab0c496fe512a | |
parent | 1e3b3bbab508360302c1fb056157d07f221ef85a (diff) | |
download | libgfbgraph-4f381aaa7937c8d378dc8a7e93bbd999a8873373.tar.gz |
tests/autoptr: Add g_autoptr test
https://gitlab.gnome.org/GNOME/libgfbgraph/merge_requests/1
-rw-r--r-- | tests/Makefile.am | 4 | ||||
-rw-r--r-- | tests/autoptr.c | 76 |
2 files changed, 79 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index efe441e..6bd4ea2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,4 @@ -TESTS = gtestutils +TESTS = gtestutils autoptr AM_CPPFLAGS = -I$(top_srcdir) $(LIBGFBGRAPH_CFLAGS) AM_LDFLAGS = $(top_builddir)/gfbgraph/libgfbgraph-@API_VERSION@.la $(LIBGFBGRAPH_LIBS) @@ -7,4 +7,6 @@ noinst_PROGRAMS = $(TESTS) gtestutils_SOURCES = gtestutils.c +autoptr_SOURCES = autoptr.c + -include $(top_srcdir)/git.mk diff --git a/tests/autoptr.c b/tests/autoptr.c new file mode 100644 index 0000000..182fc28 --- /dev/null +++ b/tests/autoptr.c @@ -0,0 +1,76 @@ +/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */ +/* + * libgfbgraph - GObject library for Facebook Graph API + * Copyright (C) 2018 Yi-Soo An <yisooan@gmail.com> + * + * GFBGraph is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * GFBGraph is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GFBGraph. If not, see <http://www.gnu.org/licenses/>. + */ + +/* + * This code is based on glib/tests/autoptr.c + */ + +#include <glib.h> + +#include <gfbgraph/gfbgraph.h> + +static void +test_gfbgraph_album (void) +{ + g_autoptr (GFBGraphAlbum) val = NULL; + + val = gfbgraph_album_new (); + g_assert_nonnull (val); +} + +static void +test_gfbgraph_node (void) +{ + g_autoptr (GFBGraphNode) val = NULL; + + val = gfbgraph_node_new (); + g_assert_nonnull (val); +} + +static void +test_gfbgraph_photo (void) +{ + g_autoptr (GFBGraphPhoto) val = NULL; + + val = gfbgraph_photo_new (); + g_assert_nonnull (val); +} + +static void +test_gfbgraph_user (void) +{ + g_autoptr (GFBGraphUser) val = NULL; + + val = gfbgraph_user_new (); + g_assert_nonnull (val); +} + +int +main (int argc, + char *argv[]) +{ + g_test_init (&argc, &argv, NULL); + + g_test_add_func ("/GFBGraph/autoptr/Album", test_gfbgraph_album); + g_test_add_func ("/GFBGraph/autoptr/Node", test_gfbgraph_node); + g_test_add_func ("/GFBGraph/autoptr/Photo", test_gfbgraph_photo); + g_test_add_func ("/GFBGraph/autoptr/User", test_gfbgraph_user); + + return g_test_run (); +} |