+ if (!axmap_isset(map, val)) {
+ printf("bit not set\n");
+ err = 1;
+ break;
+ }
+ }
+
+ if (err)
+ return err;
+
+ ff = axmap_next_free(map, osize);
+ if (ff != (uint64_t) -1ULL) {
+ printf("axmap_next_free broken: got %llu\n", (unsigned long long) ff);
+ return 1;
+ }
+
+ printf("pass!\n");
+ axmap_free(map);
+ return 0;
+}
+
+static int test_multi(size_t size, unsigned int bit_off)
+{
+ unsigned int map_size = size;
+ struct axmap *map;
+ uint64_t val = bit_off;
+ int i, err;
+
+ printf("Test multi %llu entries %u offset...", (unsigned long long) size, bit_off);
+ fflush(stdout);
+
+ map = axmap_new(map_size);
+ while (val + 128 <= map_size) {
+ err = 0;
+ for (i = val; i < val + 128; i++) {
+ if (axmap_isset(map, val + i)) {
+ printf("bit already set\n");
+ err = 1;
+ break;
+ }
+ }
+
+ if (err)
+ break;
+
+ err = axmap_set_nr(map, val, 128);
+ if (err != 128) {
+ printf("only set %u bits\n", err);
+ break;
+ }
+
+ err = 0;
+ for (i = 0; i < 128; i++) {
+ if (!axmap_isset(map, val + i)) {
+ printf("bit not set: %llu\n", (unsigned long long) val + i);
+ err = 1;
+ break;
+ }
+ }
+
+ val += 128;
+ if (err)
+ break;