From d817cc5feed1a21f52ae38edba67d891b91df544 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 1 May 2007 22:17:02 +0000 Subject: [PATCH] Tests for module 'sleep'. --- modules/sleep-tests | 11 +++++++++++ tests/test-sleep.c | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 modules/sleep-tests create mode 100644 tests/test-sleep.c diff --git a/modules/sleep-tests b/modules/sleep-tests new file mode 100644 index 0000000000..91de2eeed1 --- /dev/null +++ b/modules/sleep-tests @@ -0,0 +1,11 @@ +Files: +tests/test-sleep.c + +Depends-on: + +configure.ac: + +Makefile.am: +TESTS += test-sleep +check_PROGRAMS += test-sleep + diff --git a/tests/test-sleep.c b/tests/test-sleep.c new file mode 100644 index 0000000000..8c04f7b37e --- /dev/null +++ b/tests/test-sleep.c @@ -0,0 +1,47 @@ +/* Test of sleep() function. + Copyright (C) 2007 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 2, 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, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Bruno Haible , 2007. */ + +#include + +#include + +#include +#include + +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) + +int +main() +{ + ASSERT (sleep (1) <= 1); + + ASSERT (sleep (0) == 0); + + return 0; +} + -- 2.30.2