]> Savannah Git Hosting - gnulib.git/commitdiff
malloc-h: Add tests.
authorBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 21:17:31 +0000 (22:17 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 31 Dec 2020 21:17:31 +0000 (22:17 +0100)
* tests/test-malloc-h.c: New file.
* modules/malloc-h-tests: New file.
* tests/test-malloc-h-c++.cc: New file.
* modules/malloc-h-c++-tests: New file.

ChangeLog
modules/malloc-h-c++-tests [new file with mode: 0644]
modules/malloc-h-tests [new file with mode: 0644]
tests/test-malloc-h-c++.cc [new file with mode: 0644]
tests/test-malloc-h.c [new file with mode: 0644]

index 3490bf5c6e478439caae00fb0a40a41e754344c4..bc173b96e95870b49715a0cc05f954793d60a863 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2020-12-31  Bruno Haible  <bruno@clisp.org>
 
+       malloc-h: Add tests.
+       * tests/test-malloc-h.c: New file.
+       * modules/malloc-h-tests: New file.
+       * tests/test-malloc-h-c++.cc: New file.
+       * modules/malloc-h-c++-tests: New file.
+
        malloc-h: New module.
        * lib/malloc.in.h: New file.
        * m4/malloc_h.m4: New file.
diff --git a/modules/malloc-h-c++-tests b/modules/malloc-h-c++-tests
new file mode 100644 (file)
index 0000000..829f9e5
--- /dev/null
@@ -0,0 +1,18 @@
+Files:
+tests/test-malloc-h-c++.cc
+tests/signature.h
+
+Status:
+c++-test
+
+Depends-on:
+ansi-c++-opt
+
+configure.ac:
+
+Makefile.am:
+if ANSICXX
+TESTS += test-malloc-h-c++
+check_PROGRAMS += test-malloc-h-c++
+test_malloc_h_c___SOURCES = test-malloc-h-c++.cc
+endif
diff --git a/modules/malloc-h-tests b/modules/malloc-h-tests
new file mode 100644 (file)
index 0000000..ab26943
--- /dev/null
@@ -0,0 +1,11 @@
+Files:
+tests/test-malloc-h.c
+
+Depends-on:
+malloc-h-c++-tests
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-malloc-h
+check_PROGRAMS += test-malloc-h
diff --git a/tests/test-malloc-h-c++.cc b/tests/test-malloc-h-c++.cc
new file mode 100644 (file)
index 0000000..3758f11
--- /dev/null
@@ -0,0 +1,35 @@
+/* Test of <malloc.h> substitute in C++ mode.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#define GNULIB_NAMESPACE gnulib
+#include <config.h>
+
+#include <malloc.h>
+
+#include "signature.h"
+
+
+#if GNULIB_TEST_MEMALIGN && HAVE_MEMALIGN
+SIGNATURE_CHECK (GNULIB_NAMESPACE::memalign, void *, (size_t, size_t));
+#endif
+
+
+int
+main ()
+{
+}
diff --git a/tests/test-malloc-h.c b/tests/test-malloc-h.c
new file mode 100644 (file)
index 0000000..919fac3
--- /dev/null
@@ -0,0 +1,27 @@
+/* Test of <malloc.h> substitute.
+   Copyright (C) 2020 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2020.  */
+
+#include <config.h>
+
+#include <malloc.h>
+
+int
+main (void)
+{
+  return 0;
+}