1 /* $NetBSD: t_types.c,v 1.4 2012/03/18 07:14:08 jruoho Exp $ */
4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 __RCSID("$NetBSD: t_types.c,v 1.4 2012/03/18 07:14:08 jruoho Exp $");
34 #include <sys/types.h>
43 ATF_TC_HEAD(types_limits
, tc
)
45 atf_tc_set_md_var(tc
, "descr", "Known limits for types(3)");
48 ATF_TC_BODY(types_limits
, tc
)
54 * IEEE Std 1003.1-2008:
56 * "The type ssize_t shall be capable of storing
57 * values at least in the range [-1, {SSIZE_MAX}]."
61 ATF_REQUIRE(size
> 0);
64 ATF_REQUIRE(size
< 0);
67 * IEEE Std 1003.1-2008:
69 * "The type suseconds_t shall be a signed integer type capable
70 * of storing values at least in the range [-1, 1000000]."
73 ATF_REQUIRE(usec
> 0);
77 ATF_TC_HEAD(types_signed
, tc
)
79 atf_tc_set_md_var(tc
, "descr", "Signed types(3)"
80 " (PR standards/44847)");
83 ATF_TC_BODY(types_signed
, tc
)
92 * As noted in types(3), the following
93 * types should be signed integers.
101 ATF_CHECK((bc
- 1) <= 0);
102 ATF_CHECK((bs
- 1) <= 0);
103 ATF_CHECK((off
- 1) <= 0);
104 ATF_CHECK((pid
- 1) <= 0);
105 ATF_CHECK((size
- 1) <= 0);
108 ATF_TC(types_unsigned
);
109 ATF_TC_HEAD(types_unsigned
, tc
)
111 atf_tc_set_md_var(tc
, "descr", "Unsigned types(3)"
112 " (PR standards/18067)");
115 ATF_TC_BODY(types_unsigned
, tc
)
129 ATF_CHECK((fb
- 1) > 0);
130 ATF_CHECK((ff
- 1) > 0);
131 ATF_CHECK((ino
- 1) > 0);
132 ATF_CHECK((lim
- 1) > 0);
133 ATF_CHECK((size
- 1) > 0);
139 ATF_TP_ADD_TC(tp
, types_limits
);
140 ATF_TP_ADD_TC(tp
, types_signed
);
141 ATF_TP_ADD_TC(tp
, types_unsigned
);
143 return atf_no_error();