Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F7989005
pcmk__list_of_1_test.c
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
pcmk__list_of_1_test.c
View Options
/*
* Copyright 2022 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
* This source code is licensed under the GNU Lesser General Public License
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
#include <crm_internal.h>
#include <crm/common/unittest_internal.h>
#include <glib.h>
static void
empty_list(void **state) {
assert_false(pcmk__list_of_1(NULL));
}
static void
singleton_list(void **state) {
GList *lst = NULL;
lst = g_list_append(lst, strdup("abc"));
assert_true(pcmk__list_of_1(lst));
g_list_free_full(lst, free);
}
static void
longer_list(void **state) {
GList *lst = NULL;
lst = g_list_append(lst, strdup("abc"));
lst = g_list_append(lst, strdup("xyz"));
assert_false(pcmk__list_of_1(lst));
g_list_free_full(lst, free);
}
PCMK__UNIT_TEST(NULL, NULL,
cmocka_unit_test(empty_list),
cmocka_unit_test(singleton_list),
cmocka_unit_test(longer_list))
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Sat, Oct 25, 2:09 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609632
Default Alt Text
pcmk__list_of_1_test.c (1 KB)
Attached To
Mode
rP Pacemaker
Attached
Detach File
Event Timeline
Log In to Comment