Lines Matching refs:test

17 static void list_test_list_init(struct kunit *test)  in list_test_list_init()  argument
36 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list1)); in list_test_list_init()
37 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_init()
38 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list3)); in list_test_list_init()
39 KUNIT_EXPECT_TRUE(test, list_empty_careful(list4)); in list_test_list_init()
40 KUNIT_EXPECT_TRUE(test, list_empty_careful(list5)); in list_test_list_init()
46 static void list_test_list_add(struct kunit *test) in list_test_list_add() argument
55 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_add()
56 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_add()
57 KUNIT_EXPECT_PTR_EQ(test, b.next, &a); in list_test_list_add()
60 static void list_test_list_add_tail(struct kunit *test) in list_test_list_add_tail() argument
69 KUNIT_EXPECT_PTR_EQ(test, list.next, &a); in list_test_list_add_tail()
70 KUNIT_EXPECT_PTR_EQ(test, a.prev, &list); in list_test_list_add_tail()
71 KUNIT_EXPECT_PTR_EQ(test, a.next, &b); in list_test_list_add_tail()
74 static void list_test_list_del(struct kunit *test) in list_test_list_del() argument
86 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_del()
87 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_del()
90 static void list_test_list_replace(struct kunit *test) in list_test_list_replace() argument
102 KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new); in list_test_list_replace()
103 KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new); in list_test_list_replace()
106 static void list_test_list_replace_init(struct kunit *test) in list_test_list_replace_init() argument
118 KUNIT_EXPECT_PTR_EQ(test, list.next, &a_new); in list_test_list_replace_init()
119 KUNIT_EXPECT_PTR_EQ(test, b.prev, &a_new); in list_test_list_replace_init()
122 KUNIT_EXPECT_TRUE(test, list_empty_careful(&a_old)); in list_test_list_replace_init()
125 static void list_test_list_swap(struct kunit *test) in list_test_list_swap() argument
137 KUNIT_EXPECT_PTR_EQ(test, &b, list.next); in list_test_list_swap()
138 KUNIT_EXPECT_PTR_EQ(test, &a, list.prev); in list_test_list_swap()
140 KUNIT_EXPECT_PTR_EQ(test, &a, b.next); in list_test_list_swap()
141 KUNIT_EXPECT_PTR_EQ(test, &list, b.prev); in list_test_list_swap()
143 KUNIT_EXPECT_PTR_EQ(test, &list, a.next); in list_test_list_swap()
144 KUNIT_EXPECT_PTR_EQ(test, &b, a.prev); in list_test_list_swap()
147 static void list_test_list_del_init(struct kunit *test) in list_test_list_del_init() argument
159 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_del_init()
160 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_del_init()
161 KUNIT_EXPECT_TRUE(test, list_empty_careful(&a)); in list_test_list_del_init()
164 static void list_test_list_del_init_careful(struct kunit *test) in list_test_list_del_init_careful() argument
179 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_del_init_careful()
180 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_del_init_careful()
181 KUNIT_EXPECT_TRUE(test, list_empty_careful(&a)); in list_test_list_del_init_careful()
184 static void list_test_list_move(struct kunit *test) in list_test_list_move() argument
197 KUNIT_EXPECT_TRUE(test, list_empty(&list1)); in list_test_list_move()
199 KUNIT_EXPECT_PTR_EQ(test, &a, list2.next); in list_test_list_move()
200 KUNIT_EXPECT_PTR_EQ(test, &b, a.next); in list_test_list_move()
203 static void list_test_list_move_tail(struct kunit *test) in list_test_list_move_tail() argument
216 KUNIT_EXPECT_TRUE(test, list_empty(&list1)); in list_test_list_move_tail()
218 KUNIT_EXPECT_PTR_EQ(test, &b, list2.next); in list_test_list_move_tail()
219 KUNIT_EXPECT_PTR_EQ(test, &a, b.next); in list_test_list_move_tail()
222 static void list_test_list_bulk_move_tail(struct kunit *test) in list_test_list_bulk_move_tail() argument
245 KUNIT_EXPECT_PTR_EQ(test, ptr, list1_values[i]); in list_test_list_bulk_move_tail()
248 KUNIT_EXPECT_EQ(test, i, 4); in list_test_list_bulk_move_tail()
251 KUNIT_EXPECT_PTR_EQ(test, ptr, list2_values[i]); in list_test_list_bulk_move_tail()
254 KUNIT_EXPECT_EQ(test, i, 2); in list_test_list_bulk_move_tail()
257 static void list_test_list_is_head(struct kunit *test) in list_test_list_is_head() argument
266 KUNIT_EXPECT_TRUE_MSG(test, list_is_head(&a, &a), in list_test_list_is_head()
268 KUNIT_EXPECT_FALSE_MSG(test, list_is_head(&a, &b), in list_test_list_is_head()
270 KUNIT_EXPECT_FALSE_MSG(test, list_is_head(&a, &c), in list_test_list_is_head()
275 static void list_test_list_is_first(struct kunit *test) in list_test_list_is_first() argument
283 KUNIT_EXPECT_TRUE(test, list_is_first(&a, &list)); in list_test_list_is_first()
284 KUNIT_EXPECT_FALSE(test, list_is_first(&b, &list)); in list_test_list_is_first()
287 static void list_test_list_is_last(struct kunit *test) in list_test_list_is_last() argument
295 KUNIT_EXPECT_FALSE(test, list_is_last(&a, &list)); in list_test_list_is_last()
296 KUNIT_EXPECT_TRUE(test, list_is_last(&b, &list)); in list_test_list_is_last()
299 static void list_test_list_empty(struct kunit *test) in list_test_list_empty() argument
307 KUNIT_EXPECT_FALSE(test, list_empty(&list1)); in list_test_list_empty()
308 KUNIT_EXPECT_TRUE(test, list_empty(&list2)); in list_test_list_empty()
311 static void list_test_list_empty_careful(struct kunit *test) in list_test_list_empty_careful() argument
320 KUNIT_EXPECT_FALSE(test, list_empty_careful(&list1)); in list_test_list_empty_careful()
321 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_empty_careful()
324 static void list_test_list_rotate_left(struct kunit *test) in list_test_list_rotate_left() argument
336 KUNIT_EXPECT_PTR_EQ(test, list.next, &b); in list_test_list_rotate_left()
337 KUNIT_EXPECT_PTR_EQ(test, b.prev, &list); in list_test_list_rotate_left()
338 KUNIT_EXPECT_PTR_EQ(test, b.next, &a); in list_test_list_rotate_left()
341 static void list_test_list_rotate_to_front(struct kunit *test) in list_test_list_rotate_to_front() argument
359 KUNIT_EXPECT_PTR_EQ(test, ptr, list_values[i]); in list_test_list_rotate_to_front()
362 KUNIT_EXPECT_EQ(test, i, 4); in list_test_list_rotate_to_front()
365 static void list_test_list_is_singular(struct kunit *test) in list_test_list_is_singular() argument
371 KUNIT_EXPECT_FALSE(test, list_is_singular(&list)); in list_test_list_is_singular()
376 KUNIT_EXPECT_TRUE(test, list_is_singular(&list)); in list_test_list_is_singular()
381 KUNIT_EXPECT_FALSE(test, list_is_singular(&list)); in list_test_list_is_singular()
384 static void list_test_list_cut_position(struct kunit *test) in list_test_list_cut_position() argument
400 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_cut_position()
404 KUNIT_EXPECT_EQ(test, i, 2); in list_test_list_cut_position()
407 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_cut_position()
412 static void list_test_list_cut_before(struct kunit *test) in list_test_list_cut_before() argument
428 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_cut_before()
432 KUNIT_EXPECT_EQ(test, i, 1); in list_test_list_cut_before()
435 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_cut_before()
440 static void list_test_list_splice(struct kunit *test) in list_test_list_splice() argument
458 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_splice()
462 KUNIT_EXPECT_EQ(test, i, 5); in list_test_list_splice()
465 static void list_test_list_splice_tail(struct kunit *test) in list_test_list_splice_tail() argument
483 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_splice_tail()
487 KUNIT_EXPECT_EQ(test, i, 5); in list_test_list_splice_tail()
490 static void list_test_list_splice_init(struct kunit *test) in list_test_list_splice_init() argument
508 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_splice_init()
512 KUNIT_EXPECT_EQ(test, i, 5); in list_test_list_splice_init()
514 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_splice_init()
517 static void list_test_list_splice_tail_init(struct kunit *test) in list_test_list_splice_tail_init() argument
535 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_splice_tail_init()
539 KUNIT_EXPECT_EQ(test, i, 5); in list_test_list_splice_tail_init()
541 KUNIT_EXPECT_TRUE(test, list_empty_careful(&list2)); in list_test_list_splice_tail_init()
544 static void list_test_list_entry(struct kunit *test) in list_test_list_entry() argument
548 KUNIT_EXPECT_PTR_EQ(test, &test_struct, list_entry(&(test_struct.list), in list_test_list_entry()
552 static void list_test_list_entry_is_head(struct kunit *test) in list_test_list_entry_is_head() argument
561 KUNIT_EXPECT_TRUE_MSG(test, in list_test_list_entry_is_head()
564 KUNIT_EXPECT_FALSE_MSG(test, in list_test_list_entry_is_head()
567 KUNIT_EXPECT_FALSE_MSG(test, in list_test_list_entry_is_head()
572 static void list_test_list_first_entry(struct kunit *test) in list_test_list_first_entry() argument
581 KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_first_entry(&list, in list_test_list_first_entry()
585 static void list_test_list_last_entry(struct kunit *test) in list_test_list_last_entry() argument
594 KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_last_entry(&list, in list_test_list_last_entry()
598 static void list_test_list_first_entry_or_null(struct kunit *test) in list_test_list_first_entry_or_null() argument
603 KUNIT_EXPECT_FALSE(test, list_first_entry_or_null(&list, in list_test_list_first_entry_or_null()
609 KUNIT_EXPECT_PTR_EQ(test, &test_struct1, in list_test_list_first_entry_or_null()
614 static void list_test_list_next_entry(struct kunit *test) in list_test_list_next_entry() argument
623 KUNIT_EXPECT_PTR_EQ(test, &test_struct2, list_next_entry(&test_struct1, in list_test_list_next_entry()
627 static void list_test_list_prev_entry(struct kunit *test) in list_test_list_prev_entry() argument
636 KUNIT_EXPECT_PTR_EQ(test, &test_struct1, list_prev_entry(&test_struct2, in list_test_list_prev_entry()
640 static void list_test_list_for_each(struct kunit *test) in list_test_list_for_each() argument
651 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_for_each()
655 KUNIT_EXPECT_EQ(test, i, 3); in list_test_list_for_each()
658 static void list_test_list_for_each_prev(struct kunit *test) in list_test_list_for_each_prev() argument
669 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_for_each_prev()
673 KUNIT_EXPECT_EQ(test, i, -1); in list_test_list_for_each_prev()
676 static void list_test_list_for_each_safe(struct kunit *test) in list_test_list_for_each_safe() argument
688 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_for_each_safe()
693 KUNIT_EXPECT_EQ(test, i, 3); in list_test_list_for_each_safe()
694 KUNIT_EXPECT_TRUE(test, list_empty(&list)); in list_test_list_for_each_safe()
697 static void list_test_list_for_each_prev_safe(struct kunit *test) in list_test_list_for_each_prev_safe() argument
708 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in list_test_list_for_each_prev_safe()
713 KUNIT_EXPECT_EQ(test, i, -1); in list_test_list_for_each_prev_safe()
714 KUNIT_EXPECT_TRUE(test, list_empty(&list)); in list_test_list_for_each_prev_safe()
717 static void list_test_list_for_each_entry(struct kunit *test) in list_test_list_for_each_entry() argument
731 KUNIT_EXPECT_EQ(test, cur->data, i); in list_test_list_for_each_entry()
735 KUNIT_EXPECT_EQ(test, i, 5); in list_test_list_for_each_entry()
738 static void list_test_list_for_each_entry_reverse(struct kunit *test) in list_test_list_for_each_entry_reverse() argument
752 KUNIT_EXPECT_EQ(test, cur->data, i); in list_test_list_for_each_entry_reverse()
756 KUNIT_EXPECT_EQ(test, i, -1); in list_test_list_for_each_entry_reverse()
812 static void hlist_test_init(struct kunit *test) in hlist_test_init() argument
830 KUNIT_EXPECT_TRUE(test, hlist_empty(&list1)); in hlist_test_init()
831 KUNIT_EXPECT_TRUE(test, hlist_empty(&list2)); in hlist_test_init()
832 KUNIT_EXPECT_TRUE(test, hlist_empty(&list3)); in hlist_test_init()
833 KUNIT_EXPECT_TRUE(test, hlist_empty(list4)); in hlist_test_init()
834 KUNIT_EXPECT_TRUE(test, hlist_empty(list5)); in hlist_test_init()
840 static void hlist_test_unhashed(struct kunit *test) in hlist_test_unhashed() argument
848 KUNIT_EXPECT_TRUE(test, hlist_unhashed(&a)); in hlist_test_unhashed()
853 KUNIT_EXPECT_FALSE(test, hlist_unhashed(&a)); in hlist_test_unhashed()
858 KUNIT_EXPECT_TRUE(test, hlist_unhashed(&a)); in hlist_test_unhashed()
862 static void hlist_test_unhashed_lockless(struct kunit *test) in hlist_test_unhashed_lockless() argument
870 KUNIT_EXPECT_TRUE(test, hlist_unhashed_lockless(&a)); in hlist_test_unhashed_lockless()
875 KUNIT_EXPECT_FALSE(test, hlist_unhashed_lockless(&a)); in hlist_test_unhashed_lockless()
880 KUNIT_EXPECT_TRUE(test, hlist_unhashed_lockless(&a)); in hlist_test_unhashed_lockless()
883 static void hlist_test_del(struct kunit *test) in hlist_test_del() argument
895 KUNIT_EXPECT_PTR_EQ(test, list.first, &b); in hlist_test_del()
896 KUNIT_EXPECT_PTR_EQ(test, b.pprev, &list.first); in hlist_test_del()
899 static void hlist_test_del_init(struct kunit *test) in hlist_test_del_init() argument
911 KUNIT_EXPECT_PTR_EQ(test, list.first, &b); in hlist_test_del_init()
912 KUNIT_EXPECT_PTR_EQ(test, b.pprev, &list.first); in hlist_test_del_init()
915 KUNIT_EXPECT_PTR_EQ(test, a.next, NULL); in hlist_test_del_init()
916 KUNIT_EXPECT_PTR_EQ(test, a.pprev, NULL); in hlist_test_del_init()
920 static void hlist_test_add(struct kunit *test) in hlist_test_add() argument
931 KUNIT_EXPECT_PTR_EQ(test, list.first, &b); in hlist_test_add()
933 KUNIT_EXPECT_PTR_EQ(test, c.pprev, &(b.next)); in hlist_test_add()
934 KUNIT_EXPECT_PTR_EQ(test, b.next, &c); in hlist_test_add()
936 KUNIT_EXPECT_PTR_EQ(test, a.pprev, &(c.next)); in hlist_test_add()
937 KUNIT_EXPECT_PTR_EQ(test, c.next, &a); in hlist_test_add()
939 KUNIT_EXPECT_PTR_EQ(test, d.pprev, &(a.next)); in hlist_test_add()
940 KUNIT_EXPECT_PTR_EQ(test, a.next, &d); in hlist_test_add()
944 static void hlist_test_fake(struct kunit *test) in hlist_test_fake() argument
951 KUNIT_EXPECT_FALSE(test, hlist_fake(&a)); in hlist_test_fake()
956 KUNIT_EXPECT_TRUE(test, hlist_fake(&a)); in hlist_test_fake()
959 static void hlist_test_is_singular_node(struct kunit *test) in hlist_test_is_singular_node() argument
965 KUNIT_EXPECT_FALSE(test, hlist_is_singular_node(&a, &list)); in hlist_test_is_singular_node()
968 KUNIT_EXPECT_TRUE(test, hlist_is_singular_node(&a, &list)); in hlist_test_is_singular_node()
971 KUNIT_EXPECT_FALSE(test, hlist_is_singular_node(&a, &list)); in hlist_test_is_singular_node()
972 KUNIT_EXPECT_FALSE(test, hlist_is_singular_node(&b, &list)); in hlist_test_is_singular_node()
975 static void hlist_test_empty(struct kunit *test) in hlist_test_empty() argument
981 KUNIT_EXPECT_TRUE(test, hlist_empty(&list)); in hlist_test_empty()
986 KUNIT_EXPECT_FALSE(test, hlist_empty(&list)); in hlist_test_empty()
989 static void hlist_test_move_list(struct kunit *test) in hlist_test_move_list() argument
997 KUNIT_EXPECT_FALSE(test, hlist_empty(&list1)); in hlist_test_move_list()
998 KUNIT_EXPECT_TRUE(test, hlist_empty(&list2)); in hlist_test_move_list()
1000 KUNIT_EXPECT_TRUE(test, hlist_empty(&list1)); in hlist_test_move_list()
1001 KUNIT_EXPECT_FALSE(test, hlist_empty(&list2)); in hlist_test_move_list()
1005 static void hlist_test_entry(struct kunit *test) in hlist_test_entry() argument
1009 KUNIT_EXPECT_PTR_EQ(test, &test_struct, in hlist_test_entry()
1014 static void hlist_test_entry_safe(struct kunit *test) in hlist_test_entry_safe() argument
1018 KUNIT_EXPECT_PTR_EQ(test, &test_struct, in hlist_test_entry_safe()
1022 KUNIT_EXPECT_PTR_EQ(test, NULL, in hlist_test_entry_safe()
1027 static void hlist_test_for_each(struct kunit *test) in hlist_test_for_each() argument
1038 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in hlist_test_for_each()
1042 KUNIT_EXPECT_EQ(test, i, 3); in hlist_test_for_each()
1046 static void hlist_test_for_each_safe(struct kunit *test) in hlist_test_for_each_safe() argument
1057 KUNIT_EXPECT_PTR_EQ(test, cur, &entries[i]); in hlist_test_for_each_safe()
1062 KUNIT_EXPECT_EQ(test, i, 3); in hlist_test_for_each_safe()
1063 KUNIT_EXPECT_TRUE(test, hlist_empty(&list)); in hlist_test_for_each_safe()
1066 static void hlist_test_for_each_entry(struct kunit *test) in hlist_test_for_each_entry() argument
1082 KUNIT_EXPECT_EQ(test, cur->data, i); in hlist_test_for_each_entry()
1086 KUNIT_EXPECT_EQ(test, i, 5); in hlist_test_for_each_entry()
1089 static void hlist_test_for_each_entry_continue(struct kunit *test) in hlist_test_for_each_entry_continue() argument
1107 KUNIT_EXPECT_EQ(test, cur->data, i); in hlist_test_for_each_entry_continue()
1113 KUNIT_EXPECT_EQ(test, i, 5); in hlist_test_for_each_entry_continue()
1115 KUNIT_EXPECT_EQ(test, entries[0].data, 0); in hlist_test_for_each_entry_continue()
1117 KUNIT_EXPECT_EQ(test, entries[1].data, 42); in hlist_test_for_each_entry_continue()
1120 static void hlist_test_for_each_entry_from(struct kunit *test) in hlist_test_for_each_entry_from() argument
1137 KUNIT_EXPECT_EQ(test, cur->data, i); in hlist_test_for_each_entry_from()
1143 KUNIT_EXPECT_EQ(test, i, 5); in hlist_test_for_each_entry_from()
1145 KUNIT_EXPECT_EQ(test, entries[0].data, 42); in hlist_test_for_each_entry_from()
1148 static void hlist_test_for_each_entry_safe(struct kunit *test) in hlist_test_for_each_entry_safe() argument
1165 KUNIT_EXPECT_EQ(test, cur->data, i); in hlist_test_for_each_entry_safe()
1170 KUNIT_EXPECT_EQ(test, i, 5); in hlist_test_for_each_entry_safe()
1171 KUNIT_EXPECT_TRUE(test, hlist_empty(&list)); in hlist_test_for_each_entry_safe()