X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fintmap%2Ftest%2Frun-order.c;h=d945a4a86f5a6e35e5a6e5ad3c29956a9935b3fa;hp=f7e86692a83647bfaac224dd24495511b4880096;hb=7aac849abf06ef469c2aad9a0dd6e3bb82ef1f96;hpb=f7ead5da96bfb5ce3ebffe11256bbcb5f4b4f750 diff --git a/ccan/intmap/test/run-order.c b/ccan/intmap/test/run-order.c index f7e86692..d945a4a8 100644 --- a/ccan/intmap/test/run-order.c +++ b/ccan/intmap/test/run-order.c @@ -36,6 +36,19 @@ static bool check_umap(const umap *map) last = (uintmap_last(map, &last_idx) == v); } + if (!last) + return false; + + prev = INT_MAX; + for (v = uintmap_last(map, &i); v; v = uintmap_before(map, &i)) { + if ((int64_t)i >= prev) + return false; + if (*v != i) + return false; + prev = i; + last = (uintmap_first(map, &last_idx) == v); + } + if (!last) return false; @@ -71,6 +84,18 @@ static bool check_smap(const smap *map) prev = i; } + if (!last) + return false; + + prev = 0x80000001ULL; + for (v = sintmap_last(map, &i); v; v = sintmap_before(map, &i)) { + if (i >= prev) + return false; + if (*v != i) + return false; + prev = i; + last = (sintmap_first(map, &last_idx) == v); + } if (!last) return false;