175 s = 6; |
175 s = 6; |
176 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 2); |
176 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 2); |
177 s = 8; |
177 s = 8; |
178 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 3); |
178 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 3); |
179 s = 10; |
179 s = 10; |
180 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 4); |
180 EXPECT_LT(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 0); |
181 s = -2; |
181 s = -2; |
182 EXPECT_EQ(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 4); |
182 EXPECT_LT(cx_linked_list_find(list, loc_next, loc_data, cx_cmp_int, &s), 0); |
183 } |
183 } |
184 |
184 |
185 TEST(LinkedList_LowLevel, cx_linked_list_compare) { |
185 TEST(LinkedList_LowLevel, cx_linked_list_compare) { |
186 auto ta = create_nodes_test_data({2, 4, 6, 8}); |
186 auto ta = create_nodes_test_data({2, 4, 6, 8}); |
187 auto tb = create_nodes_test_data({2, 4, 6}); |
187 auto tb = create_nodes_test_data({2, 4, 6}); |
835 } |
835 } |
836 EXPECT_EQ(cxListFind(list, &val), exp); |
836 EXPECT_EQ(cxListFind(list, &val), exp); |
837 } |
837 } |
838 |
838 |
839 int notinlist = -1; |
839 int notinlist = -1; |
840 EXPECT_EQ(cxListSize(list), cxListFind(list, ¬inlist)); |
840 EXPECT_LT(cxListFind(list, ¬inlist), 0); |
841 } |
841 } |
842 |
842 |
843 void verifySort(CxList *list) const { |
843 void verifySort(CxList *list) const { |
844 std::array<int, testdata_len> expected{}; |
844 std::array<int, testdata_len> expected{}; |
845 std::partial_sort_copy(testdata.data.begin(), testdata.data.end(), expected.begin(), expected.end()); |
845 std::partial_sort_copy(testdata.data.begin(), testdata.data.end(), expected.begin(), expected.end()); |