Merge branch 'develop' into le-data-channel

This commit is contained in:
Matthias Ringwald 2016-07-22 19:52:21 +02:00
commit 6af1053c16
2 changed files with 15 additions and 1 deletions

View File

@ -118,7 +118,7 @@ int btstack_linked_list_remove(btstack_linked_list_t * list, btstack_linked_ite
int btstack_linked_list_count(btstack_linked_list_t * list){
btstack_linked_item_t *it;
int counter = 0;
for (it = (btstack_linked_item_t *) list; it ; it = it->next) {
for (it = (btstack_linked_item_t *) list; it->next ; it = it->next) {
counter++;
}
return counter;

View File

@ -8,6 +8,16 @@ btstack_linked_item_t itemB;
btstack_linked_item_t itemC;
btstack_linked_item_t itemD;
TEST_GROUP(LinkedListEmpty){
void setup(void){
testList = NULL;
}
};
TEST(LinkedListEmpty, CountAll){
CHECK_EQUAL(0, btstack_linked_list_count(&testList));
}
TEST_GROUP(LinkedList){
void setup(void){
testList = NULL;
@ -18,6 +28,10 @@ TEST_GROUP(LinkedList){
}
};
TEST(LinkedList, CountAll){
CHECK_EQUAL(4, btstack_linked_list_count(&testList));
}
TEST(LinkedList, Iterator){
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &testList);