+2011-02-08 Bruno Haible <bruno@clisp.org>
+
+ di-set tests: Refactor.
+ * tests/test-di-set.c: Include di-set.h early. Include macros.h. Drop
+ unnecessary includes.
+ (ASSERT): Remove macro.
+ (main): Make C90 compliant by avoiding variable declaration after
+ statement.
+ * modules/di-set-tests (Files): Add tests/macros.h.
+
2011-02-08 Bruno Haible <bruno@clisp.org>
ino-map tests: Refactor.
/* Written by Jim Meyering. */
#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdint.h>
-
-#define ASSERT(expr) \
- do \
- { \
- if (!(expr)) \
- { \
- fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
- fflush (stderr); \
- abort (); \
- } \
- } \
- while (0)
#include "di-set.h"
+#include "macros.h"
+
int
main (void)
{
ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 1);
ASSERT (di_set_insert (dis, 5, (ino_t) -1) == 0); /* dup */
- unsigned int i;
- for (i = 0; i < 3000; i++)
- ASSERT (di_set_insert (dis, 9, i) == 1);
- for (i = 0; i < 3000; i++)
- ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
+ {
+ unsigned int i;
+ for (i = 0; i < 3000; i++)
+ ASSERT (di_set_insert (dis, 9, i) == 1);
+ for (i = 0; i < 3000; i++)
+ ASSERT (di_set_insert (dis, 9, i) == 0); /* duplicate fails */
+ }
di_set_free (dis);