<p>Max has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11875">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Add basic test for llist counter and empty check<br><br>Change-Id: Ie1c15c330213849f089032ca742e709e4349b26e<br>---<br>M tests/utils/utils_test.c<br>M tests/utils/utils_test.ok<br>2 files changed, 22 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/11875/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c</span><br><span>index 2bb1f9c..eaaae79 100644</span><br><span>--- a/tests/utils/utils_test.c</span><br><span>+++ b/tests/utils/utils_test.c</span><br><span>@@ -798,6 +798,21 @@</span><br><span>   OSMO_ASSERT(ok);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static void test_llist()</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        static LLIST_HEAD(test_list);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct llist_head item;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     printf("\nTest list routines\n");</span><br><span style="color: hsl(120, 100%, 40%);">+   printf("Initial list [empty %u]: %u items (each is empty %u)\n", llist_empty(&test_list), llist_count(&test_list), llist_empty(&item));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       llist_add(&item, &test_list);</span><br><span style="color: hsl(120, 100%, 40%);">+ printf("Added list [empty %u]: %u item\n", llist_empty(&test_list), llist_count(&test_list));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     llist_del(&item);</span><br><span style="color: hsl(120, 100%, 40%);">+ printf("Deleted list [empty %u]: %u items\n", llist_empty(&test_list), llist_count(&test_list));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> </span><br><span> int main(int argc, char **argv)</span><br><span> {</span><br><span>@@ -815,5 +830,7 @@</span><br><span>    isqrt_test();</span><br><span>        osmo_sockaddr_to_str_and_uint_test();</span><br><span>        osmo_str_tolowupper_test();</span><br><span style="color: hsl(120, 100%, 40%);">+   test_llist();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>      return 0;</span><br><span> }</span><br><span>diff --git a/tests/utils/utils_test.ok b/tests/utils/utils_test.ok</span><br><span>index 3ea8ec6..7c4505e 100644</span><br><span>--- a/tests/utils/utils_test.ok</span><br><span>+++ b/tests/utils/utils_test.ok</span><br><span>@@ -199,3 +199,8 @@</span><br><span>                    = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"</span><br><span> osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)</span><br><span>                    = 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Test list routines</span><br><span style="color: hsl(120, 100%, 40%);">+Initial list [empty 1]: 0 items (each is empty 0)</span><br><span style="color: hsl(120, 100%, 40%);">+Added list [empty 0]: 1 item</span><br><span style="color: hsl(120, 100%, 40%);">+Deleted list [empty 1]: 0 items</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11875">change 11875</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/11875"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie1c15c330213849f089032ca742e709e4349b26e </div>
<div style="display:none"> Gerrit-Change-Number: 11875 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Max <msuraev@sysmocom.de> </div>