X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fintmap%2Ftest%2Frun-order.c;fp=ccan%2Fintmap%2Ftest%2Frun-order.c;h=0f8168d7fde54b3a0c3ec64cf790a162dadb148d;hb=09bb99b92546f3e8be6bb0f9218924b8491be461;hp=1b2fdffdfadcb68eeadebe547ae5c9510bebcc11;hpb=8502a66a5ba8916758c67ea5b0b404386c34da24;p=ccan diff --git a/ccan/intmap/test/run-order.c b/ccan/intmap/test/run-order.c index 1b2fdffd..0f8168d7 100644 --- a/ccan/intmap/test/run-order.c +++ b/ccan/intmap/test/run-order.c @@ -11,8 +11,9 @@ static bool check_umap(const umap *map) { /* This is a larger type than unsigned, and allows negative */ int64_t prev; - uint64_t i; + uint64_t i, last_idx; unsigned int *v; + bool last = true; /* Must be in order, must contain value. */ prev = -1; @@ -22,15 +23,17 @@ static bool check_umap(const umap *map) if (*v != i) return false; prev = i; + last = (uintmap_last(map, &last_idx) == v); } - return true; + return last; } static bool check_smap(const smap *map) { /* This is a larger type than int, and allows negative */ - int64_t prev, i; + int64_t prev, i, last_idx; int *v; + bool last = true; /* Must be in order, must contain value. */ prev = -0x80000001ULL; @@ -39,9 +42,10 @@ static bool check_smap(const smap *map) return false; if (*v != i) return false; + last = (sintmap_last(map, &last_idx) == v); prev = i; } - return true; + return last; } int main(void)