changeset 30274:c154fabf8cad

Tests for module 'getdtablesize'.
author Bruno Haible <bruno@clisp.org>
date Sun, 05 Oct 2008 16:52:15 +0200
parents c9ca8a5f6680
children 767106b52f9e
files ChangeLog modules/getdtablesize-tests tests/test-getdtablesize.c
diffstat 3 files changed, 57 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Oct 05 16:51:07 2008 +0200
+++ b/ChangeLog	Sun Oct 05 16:52:15 2008 +0200
@@ -1,5 +1,8 @@
 2008-10-05  Bruno Haible  <bruno@clisp.org>
 
+	* modules/getdtablesize-tests: New file.
+	* tests/test-getdtablesize.c: New file.
+
 	New module 'getdtablesize'.
 	* lib/unistd.in.h (getdtablesize): New declaration.
 	* lib/getdtablesize.c: New file.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/getdtablesize-tests	Sun Oct 05 16:52:15 2008 +0200
@@ -0,0 +1,10 @@
+Files:
+tests/test-getdtablesize.c
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-getdtablesize
+check_PROGRAMS += test-getdtablesize
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-getdtablesize.c	Sun Oct 05 16:52:15 2008 +0200
@@ -0,0 +1,44 @@
+/* Test of getdtablesize() function.
+   Copyright (C) 2008 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 <http://www.gnu.org/licenses/>.  */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2008.  */
+
+#include <config.h>
+
+#include <unistd.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define ASSERT(expr) \
+  do									     \
+    {									     \
+      if (!(expr))							     \
+        {								     \
+          fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+          fflush (stderr);						     \
+          abort ();							     \
+        }								     \
+    }									     \
+  while (0)
+
+int
+main (int argc, char *argv[])
+{
+  ASSERT (getdtablesize () >= 3);
+
+  return 0;
+}