Remove building with NOCRYPTO option
[minix3.git] / tests / include / sys / t_types.c
blob45b715fc8c63df599455738155b3471563bfc49f
1 /* $NetBSD: t_types.c,v 1.4 2012/03/18 07:14:08 jruoho Exp $ */
3 /*-
4 * Copyright (c) 2011 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jukka Ruohonen.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
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>
36 #include <atf-c.h>
37 #include <limits.h>
38 #include <stdint.h>
40 #include <stdio.h>
42 ATF_TC(types_limits);
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)
50 useconds_t usec;
51 ssize_t size;
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}]."
60 size = SSIZE_MAX;
61 ATF_REQUIRE(size > 0);
63 size = size + 1;
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]."
72 usec = 1000000;
73 ATF_REQUIRE(usec > 0);
76 ATF_TC(types_signed);
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)
85 blkcnt_t bc;
86 blksize_t bs;
87 ssize_t size;
88 off_t off;
89 pid_t pid;
92 * As noted in types(3), the following
93 * types should be signed integers.
95 bc = 0;
96 bs = 0;
97 off = 0;
98 pid = 0;
99 size = 0;
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)
117 fsblkcnt_t fb;
118 fsfilcnt_t ff;
119 size_t size;
120 rlim_t lim;
121 ino_t ino;
123 fb = 0;
124 ff = 0;
125 ino = 0;
126 lim = 0;
127 size = 0;
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);
136 ATF_TP_ADD_TCS(tp)
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();