From 03261851a10dd2d6900a0a00a7515a0a46fb5d76 Mon Sep 17 00:00:00 2001 From: Ranjith Kumaran Date: Fri, 17 Mar 2000 22:48:54 +0000 Subject: 20000317 sourceware import --- libgloss/testsuite/libgloss.all/memory.c | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 libgloss/testsuite/libgloss.all/memory.c (limited to 'libgloss/testsuite/libgloss.all/memory.c') diff --git a/libgloss/testsuite/libgloss.all/memory.c b/libgloss/testsuite/libgloss.all/memory.c new file mode 100644 index 000000000..6e0422d3d --- /dev/null +++ b/libgloss/testsuite/libgloss.all/memory.c @@ -0,0 +1,38 @@ +/* WinBond bug report + + malloc() returns 0x0. + + test the memory calls. These test sbrk(), which is part of glue.c + for most architectures. + */ + +#include +#define BUFSIZE 80 + +main() +{ + char *buf; + char *tmp; + char *result; + + /* see if we can get some memory */ + buf = (char *)malloc(BUFSIZE); + if (buf != 0x0) { + pass ("malloc"); + } else { + fail ("malloc"); + } + + /* see if we can realloc it */ + tmp = buf; + result = (char *)realloc (buf, BUFSIZE+100); + if ((buf != 0x0) && (result != 0x0)) { + pass ("realloc"); + } else { + fail ("realloc"); + } + + /* see if we can free it up. FIXME: how to test free ?*/ + free (buf); + fflush (stdout); +} -- cgit v1.2.3