X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fintmap%2Ftest%2Frun-order-smallsize.c;fp=ccan%2Fintmap%2Ftest%2Frun-order-smallsize.c;h=63c5b9c9f63514f7c58e857c2c992af11cf7c669;hb=09bb99b92546f3e8be6bb0f9218924b8491be461;hp=3633180ea93880b337016582277aaf8af2f8ab85;hpb=8502a66a5ba8916758c67ea5b0b404386c34da24;p=ccan diff --git a/ccan/intmap/test/run-order-smallsize.c b/ccan/intmap/test/run-order-smallsize.c index 3633180e..63c5b9c9 100644 --- a/ccan/intmap/test/run-order-smallsize.c +++ b/ccan/intmap/test/run-order-smallsize.c @@ -14,8 +14,9 @@ static bool check_umap(const umap *map) { /* This is a larger type than unsigned, and allows negative */ int64_t prev; - intmap_index_t i; + intmap_index_t i, last_idx; uint8_t *v; + bool last = true; /* Must be in order, must contain value. */ prev = -1; @@ -25,16 +26,18 @@ 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; - sintmap_index_t i; + sintmap_index_t i, last_idx; int8_t *v; + bool last = true; /* Must be in order, must contain value. */ prev = -0x80000001ULL; @@ -44,8 +47,9 @@ static bool check_smap(const smap *map) if (*v != i) return false; prev = i; + last = (sintmap_last(map, &last_idx) == v); } - return true; + return last; } int main(void)