Commit 9cf43772 authored by J M's avatar J M Committed by Carles Cufi
Browse files

sys: lists: Add tests for newly-added list len functions



This commit adds tests for the newly added list len APIs to the
corresponding test cases. It is noted that the test functions calculate
equivalent values manually using several different internal list
functions. This has been left unmodified to ensure that the manual ways
using each of the various for_each functions results in the same value
as the new list_len() functions.

Signed-off-by: default avatarJ M <montytyper@msn.com>
parent dbb786da
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ static inline bool verify_emptyness(sys_dlist_t *list)
		return false;
	}

	if (sys_dlist_len(list) != 0) {
		return false;
	}

	count = 0;
	SYS_DLIST_FOR_EACH_NODE(list, node) {
		count++;
@@ -97,6 +101,10 @@ static inline bool verify_content_amount(sys_dlist_t *list, int amount)
		return false;
	}

	if (sys_dlist_len(list) != amount) {
		return false;
	}

	count = 0;
	SYS_DLIST_FOR_EACH_NODE(list, node) {
		count++;
+8 −0
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ static inline bool verify_emptyness(sys_sflist_t *list)
		return false;
	}

	if (sys_sflist_len(list) != 0) {
		return false;
	}

	count = 0;
	SYS_SFLIST_FOR_EACH_NODE(list, node) {
		count++;
@@ -98,6 +102,10 @@ static inline bool verify_content_amount(sys_sflist_t *list, int amount)
		return false;
	}

	if (sys_sflist_len(list) != amount) {
		return false;
	}

	count = 0;
	SYS_SFLIST_FOR_EACH_NODE(list, node) {
		count++;
+8 −0
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ static inline bool verify_emptyness(sys_slist_t *list)
		return false;
	}

	if (sys_slist_len(list) != 0) {
		return false;
	}

	count = 0;
	SYS_SLIST_FOR_EACH_NODE(list, node) {
		count++;
@@ -98,6 +102,10 @@ static inline bool verify_content_amount(sys_slist_t *list, int amount)
		return false;
	}

	if (sys_slist_len(list) != amount) {
		return false;
	}

	count = 0;
	SYS_SLIST_FOR_EACH_NODE(list, node) {
		count++;