Change in libosmocore[master]: Add basic test for llist counter and empty check

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Thu Nov 22 10:51:03 UTC 2018


Max has uploaded this change for review. ( https://gerrit.osmocom.org/11875


Change subject: Add basic test for llist counter and empty check
......................................................................

Add basic test for llist counter and empty check

Change-Id: Ie1c15c330213849f089032ca742e709e4349b26e
---
M tests/utils/utils_test.c
M tests/utils/utils_test.ok
2 files changed, 22 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/75/11875/1

diff --git a/tests/utils/utils_test.c b/tests/utils/utils_test.c
index 2bb1f9c..eaaae79 100644
--- a/tests/utils/utils_test.c
+++ b/tests/utils/utils_test.c
@@ -798,6 +798,21 @@
 	OSMO_ASSERT(ok);
 }
 
+static void test_llist()
+{
+	static LLIST_HEAD(test_list);
+	struct llist_head item;
+
+	printf("\nTest list routines\n");
+	printf("Initial list [empty %u]: %u items (each is empty %u)\n", llist_empty(&test_list), llist_count(&test_list), llist_empty(&item));
+
+	llist_add(&item, &test_list);
+	printf("Added list [empty %u]: %u item\n", llist_empty(&test_list), llist_count(&test_list));
+
+	llist_del(&item);
+	printf("Deleted list [empty %u]: %u items\n", llist_empty(&test_list), llist_count(&test_list));
+}
+
 
 int main(int argc, char **argv)
 {
@@ -815,5 +830,7 @@
 	isqrt_test();
 	osmo_sockaddr_to_str_and_uint_test();
 	osmo_str_tolowupper_test();
+	test_llist();
+
 	return 0;
 }
diff --git a/tests/utils/utils_test.ok b/tests/utils/utils_test.ok
index 3ea8ec6..7c4505e 100644
--- a/tests/utils/utils_test.ok
+++ b/tests/utils/utils_test.ok
@@ -199,3 +199,8 @@
                    = 62, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
 osmo_str_toupper_buf(28, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()", in-place)
                    = 27, "ABCDEFGHIJKLMNOPQRSTUVWXYZA"
+
+Test list routines
+Initial list [empty 1]: 0 items (each is empty 0)
+Added list [empty 0]: 1 item
+Deleted list [empty 1]: 0 items

-- 
To view, visit https://gerrit.osmocom.org/11875
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie1c15c330213849f089032ca742e709e4349b26e
Gerrit-Change-Number: 11875
Gerrit-PatchSet: 1
Gerrit-Owner: Max <msuraev at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181122/8cac9aae/attachment.htm>


More information about the gerrit-log mailing list