annotate tests/test-sleep.c @ 8787:e6cc4a44ff1a

Tests for module 'sleep'.
author Bruno Haible <bruno@clisp.org>
date Tue, 01 May 2007 22:17:02 +0000
parents
children bbbbbf4cd1c5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8787
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Test of sleep() function.
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2007 Free Software Foundation, Inc.
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 /* Written by Bruno Haible <bruno@clisp.org>, 2007. */
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 #include <config.h>
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 #include <unistd.h>
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 #include <stdio.h>
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 #include <stdlib.h>
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #define ASSERT(expr) \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 do \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 { \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 if (!(expr)) \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 { \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 abort (); \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 } \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 } \
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 while (0)
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 int
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 main()
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 {
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 ASSERT (sleep (1) <= 1);
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 ASSERT (sleep (0) == 0);
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 return 0;
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 }
e6cc4a44ff1a Tests for module 'sleep'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47