tests/test_list.cpp

changeset 662
d0d95740071b
parent 655
7340c4255f1f
child 666
b5dd654deb3b
equal deleted inserted replaced
661:0a71ac9547fd 662:d0d95740071b
913 EXPECT_EQ(list->itemsize, sizeof(int)); 913 EXPECT_EQ(list->itemsize, sizeof(int));
914 EXPECT_EQ(list->capacity, (size_t) -1); 914 EXPECT_EQ(list->capacity, (size_t) -1);
915 verifyCreate(list); 915 verifyCreate(list);
916 } 916 }
917 917
918 TEST_F(LinkedList, cxLinkedListCreateSimple) {
919 CxList *list = autofree(cxLinkedListCreateSimple(sizeof(int)));
920 ASSERT_NE(list, nullptr);
921 EXPECT_EQ(list->itemsize, sizeof(int));
922 EXPECT_EQ(list->capacity, (size_t) -1);
923 EXPECT_EQ(list->cmpfunc, nullptr);
924 EXPECT_EQ(list->allocator, cxDefaultAllocator);
925 }
926
918 TEST_F(ArrayList, cxArrayListCreate) { 927 TEST_F(ArrayList, cxArrayListCreate) {
919 CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8)); 928 CxList *list = autofree(cxArrayListCreate(&testingAllocator, cx_cmp_int, sizeof(int), 8));
920 ASSERT_NE(list, nullptr); 929 ASSERT_NE(list, nullptr);
921 EXPECT_EQ(list->itemsize, sizeof(int)); 930 EXPECT_EQ(list->itemsize, sizeof(int));
922 EXPECT_EQ(list->capacity, 8); 931 EXPECT_EQ(list->capacity, 8);
923 verifyCreate(list); 932 verifyCreate(list);
933 }
934
935 TEST_F(ArrayList, cxArrayListCreateSimple) {
936 CxList *list = autofree(cxArrayListCreateSimple(sizeof(int), 8));
937 ASSERT_NE(list, nullptr);
938 EXPECT_EQ(list->cmpfunc, nullptr);
939 EXPECT_EQ(list->allocator, cxDefaultAllocator);
940 EXPECT_EQ(list->itemsize, sizeof(int));
941 EXPECT_EQ(list->capacity, 8);
924 } 942 }
925 943
926 TEST_F(LinkedList, cxListAdd) { 944 TEST_F(LinkedList, cxListAdd) {
927 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int))); 945 auto list = autofree(cxLinkedListCreate(&testingAllocator, cx_cmp_int, sizeof(int)));
928 verifyAdd(list, false); 946 verifyAdd(list, false);

mercurial