2
* FreeRDP: A Remote Desktop Protocol Client
5
* Copyright 2011 Vic Lee
7
* Licensed under the Apache License, Version 2.0 (the "License");
8
* you may not use this file except in compliance with the License.
9
* You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing, software
14
* distributed under the License is distributed on an "AS IS" BASIS,
15
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
* See the License for the specific language governing permissions and
17
* limitations under the License.
23
#include <freerdp/freerdp.h>
24
#include <freerdp/utils/list.h>
26
#include "test_list.h"
28
int init_list_suite(void)
33
int clean_list_suite(void)
38
int add_list_suite(void)
42
add_test_function(list);
52
typedef struct _my_list_item my_list_item;
65
for (i = 0; i < 10; i++)
67
item = xnew(my_list_item);
70
list_enqueue(list, item);
73
for (i = 0, list_item = list->head; list_item; i++, list_item = list_item->next)
75
CU_ASSERT(((my_list_item*)list_item->data)->a == i);
76
CU_ASSERT(((my_list_item*)list_item->data)->b == i * i);
77
/*printf("%d %d\n", item->a, item->b);*/
80
item1 = xnew(my_list_item);
81
list_add(list, item1);
82
item2 = xnew(my_list_item);
83
list_add(list, item2);
85
CU_ASSERT(list_remove(list, item1) == item1);
87
CU_ASSERT(list_remove(list, item2) == item2);
88
CU_ASSERT(list_remove(list, item2) == NULL);
91
while ((item = list_dequeue(list)) != NULL)