]> git.ozlabs.org Git - ccan/blobdiff - ccan/intmap/test/run-order.c
base64: fix for unsigned chars (e.g. ARM).
[ccan] / ccan / intmap / test / run-order.c
index f7e86692a83647bfaac224dd24495511b4880096..d945a4a86f5a6e35e5a6e5ad3c29956a9935b3fa 100644 (file)
@@ -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;