[riot-notifications] [RIOT-OS/RIOT] core/clist: add special cardinality tests and matching unittest (#16330)

benpicco notifications at github.com
Wed Apr 14 17:09:34 CEST 2021


@benpicco commented on this pull request.



> +    TEST_ASSERT(!clist_more_than_one(&test_clist));
+
+    clist_rpush(&test_clist, &tests_clist_buf[i++]);
+
+    TEST_ASSERT(!clist_is_empty(&test_clist));
+    TEST_ASSERT(clist_exactly_one(&test_clist));
+    TEST_ASSERT(!clist_more_than_one(&test_clist));
+
+    while (i < TEST_CLIST_LEN) {
+        clist_rpush(&test_clist, &tests_clist_buf[i++]);
+
+        TEST_ASSERT(!clist_is_empty(&test_clist));
+        TEST_ASSERT(!clist_exactly_one(&test_clist));
+        TEST_ASSERT(clist_more_than_one(&test_clist));
+    }
+    do{

```suggestion
    do {
```

> +    TEST_ASSERT(!clist_more_than_one(&test_clist));
+
+    while (i < TEST_CLIST_LEN) {
+        clist_rpush(&test_clist, &tests_clist_buf[i++]);
+
+        TEST_ASSERT(!clist_is_empty(&test_clist));
+        TEST_ASSERT(!clist_exactly_one(&test_clist));
+        TEST_ASSERT(clist_more_than_one(&test_clist));
+    }
+    do{
+        TEST_ASSERT(!clist_is_empty(&test_clist));
+        TEST_ASSERT(!clist_exactly_one(&test_clist));
+        TEST_ASSERT(clist_more_than_one(&test_clist));
+
+        clist_lpop(&test_clist);
+    }while (--i>1);

```suggestion
    } while (--i > 1);
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/16330#pullrequestreview-635738824
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210414/a271f4d4/attachment.htm>


More information about the notifications mailing list