1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00
lvm2/test/unit/dmlist_t.c
Zdenek Kabelac 1fb8d746d6 tests: make unit testing usable again
Make unit tests usable/compilable with newer header files.
Add 'initial' dmlist_t  for list tests.
More will come...
2015-11-27 11:22:21 +01:00

50 lines
1.1 KiB
C

/*
* Copyright (C) 2015 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License v.2.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "units.h"
int dmlist_init(void)
{
return 0;
}
int dmlist_fini(void)
{
return 0;
}
static void test_dmlist_splice(void)
{
struct dm_list a[10];
struct dm_list list1;
struct dm_list list2;
unsigned i;
dm_list_init(&list1);
dm_list_init(&list2);
for (i = 0; i < DM_ARRAY_SIZE(a); i++)
dm_list_add(&list1, &a[i]);
dm_list_splice(&list2, &list1);
CU_ASSERT_EQUAL(dm_list_size(&list1), 0);
CU_ASSERT_EQUAL(dm_list_size(&list2), 10);
}
CU_TestInfo dmlist_list[] = {
{ (char*)"dmlist_splice", test_dmlist_splice },
//{ (char*)"dmlist", test_strncpy },
CU_TEST_INFO_NULL
};