projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added YAZ_CHECK_TERM which terminates test program. Using yaz/test.h
[yaz-moved-to-github.git]
/
test
/
tstnmem.c
diff --git
a/test/tstnmem.c
b/test/tstnmem.c
index
8d77927
..
000c7d2
100644
(file)
--- a/
test/tstnmem.c
+++ b/
test/tstnmem.c
@@
-1,8
+1,8
@@
/*
/*
- * Copyright (c) 2002-2004, Index Data
+ * Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
* See the file LICENSE for details.
*
- * $Id: tstnmem.c,v 1.3 2005-01-05 10:29:42 adam Exp $
+ * $Id: tstnmem.c,v 1.6 2006-01-29 21:59:13 adam Exp $
*/
#if HAVE_CONFIG_H
*/
#if HAVE_CONFIG_H
@@
-15,39
+15,52
@@
#include <ctype.h>
#include <yaz/nmem.h>
#include <ctype.h>
#include <yaz/nmem.h>
+#include <yaz/test.h>
-int main (int argc, char **argv)
+void tst(void)
{
{
- void *cp;
NMEM n;
int j;
NMEM n;
int j;
+ char *cp;
nmem_init();
n = nmem_create();
nmem_init();
n = nmem_create();
- if (!n)
- exit (1);
+ YAZ_CHECK(n);
+
for (j = 1; j<500; j++)
{
cp = nmem_malloc(n, j);
for (j = 1; j<500; j++)
{
cp = nmem_malloc(n, j);
- if (!cp)
- exit(2);
- if (sizeof(long) >= j)
- *(long*) cp = 123L;
+ YAZ_CHECK(cp);
+ if (sizeof(long) >= j)
+ *(long*) cp = 123L;
#if HAVE_LONG_LONG
#if HAVE_LONG_LONG
- if (sizeof(long long) >= j)
- *(long long*) cp = 123L;
+ if (sizeof(long long) >= j)
+ *(long long*) cp = 123L;
#endif
#endif
- if (sizeof(double) >= j)
- *(double*) cp = 12.2;
+ if (sizeof(double) >= j)
+ *(double*) cp = 12.2;
}
for (j = 2000; j<20000; j+= 2000)
{
cp = nmem_malloc(n, j);
}
for (j = 2000; j<20000; j+= 2000)
{
cp = nmem_malloc(n, j);
- if (!cp)
- exit(3);
+ YAZ_CHECK(cp);
}
nmem_destroy(n);
nmem_exit();
}
nmem_destroy(n);
nmem_exit();
- exit(0);
}
}
+
+int main (int argc, char **argv)
+{
+ YAZ_CHECK_INIT(argc, argv);
+ tst();
+ YAZ_CHECK_TERM;
+}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+