提交 8339f9c8 编写于 作者: H hzcheng

TD-34

上级 d127890a
...@@ -100,6 +100,8 @@ SListNode *tdListPopHead(SList *list) { ...@@ -100,6 +100,8 @@ SListNode *tdListPopHead(SList *list) {
list->head = node->next; list->head = node->next;
} }
list->numOfEles--; list->numOfEles--;
node->next = NULL;
node->prev = NULL;
return node; return node;
} }
...@@ -113,6 +115,7 @@ SListNode *tdListPopTail(SList *list) { ...@@ -113,6 +115,7 @@ SListNode *tdListPopTail(SList *list) {
list->tail = node->prev; list->tail = node->prev;
} }
list->numOfEles--; list->numOfEles--;
node->next = node->prev = NULL;
return node; return node;
} }
...@@ -131,6 +134,7 @@ SListNode *tdListPopNode(SList *list, SListNode *node) { ...@@ -131,6 +134,7 @@ SListNode *tdListPopNode(SList *list, SListNode *node) {
node->next->prev = node->prev; node->next->prev = node->prev;
} }
list->numOfEles--; list->numOfEles--;
node->next = node->prev = NULL;
return node; return node;
} }
......
...@@ -157,22 +157,22 @@ TEST(testCase, string_strnchr_test) { ...@@ -157,22 +157,22 @@ TEST(testCase, string_strnchr_test) {
EXPECT_TRUE(strnchr(a10, '.', strlen(a10), true) == NULL); EXPECT_TRUE(strnchr(a10, '.', strlen(a10), true) == NULL);
} }
TEST(testCase, cache_resize_test) { // TEST(testCase, cache_resize_test) {
char a11[] = "abc'.'"; // char a11[] = "abc'.'";
EXPECT_TRUE(strnchr(a11, '.', strlen(a11), false) != NULL); // EXPECT_TRUE(strnchr(a11, '.', strlen(a11), false) != NULL);
char a12[] = "abc'-'"; // char a12[] = "abc'-'";
EXPECT_TRUE(strnchr(a12, '-', strlen(a12), false) != NULL); // EXPECT_TRUE(strnchr(a12, '-', strlen(a12), false) != NULL);
char a15[] = "abc'-'"; // char a15[] = "abc'-'";
EXPECT_TRUE(strnchr(a15, '-', strlen(a15), true) == NULL); // EXPECT_TRUE(strnchr(a15, '-', strlen(a15), true) == NULL);
char a13[] = "'-'"; // char a13[] = "'-'";
EXPECT_TRUE(strnchr(a13, '-', strlen(a13), false) != NULL); // EXPECT_TRUE(strnchr(a13, '-', strlen(a13), false) != NULL);
char a14[] = "'-'"; // char a14[] = "'-'";
EXPECT_TRUE(strnchr(a14, '-', strlen(a14), true) == NULL); // EXPECT_TRUE(strnchr(a14, '-', strlen(a14), true) == NULL);
char a16[] = "'-'."; // char a16[] = "'-'.";
EXPECT_TRUE(strnchr(a16, '.', strlen(a16), true) != NULL); // EXPECT_TRUE(strnchr(a16, '.', strlen(a16), true) != NULL);
} // }
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册