1 /* Copyright (C) 2005-2022 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, see
16 <https://www.gnu.org/licenses/>. */
27 unsigned char buf
[8192];
35 u_quad_t v_u_longlong_t
;
44 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_ENCODE
);
59 T(u_int, 0xdeadbeef) \
60 T(u_int, 0x12345678) \
62 T(long, 2147483647L) \
63 T(long, -2147483648L) \
64 T(long, -305419896L) \
65 T(long, -305419896L) \
67 T(u_long, 0xffffffffUL) \
68 T(u_long, 0xdeadbeefUL) \
69 T(u_long, 0x12345678UL) \
79 T(hyper, LONG_LONG_MAX) \
80 T(hyper, LONG_LONG_MIN) \
81 T(hyper, 0x12312345678LL) \
82 T(hyper, 0x12387654321LL) \
84 T(u_hyper, UCHAR_MAX) \
85 T(u_hyper, USHRT_MAX) \
86 T(u_hyper, UINT_MAX) \
87 T(u_hyper, ULONG_MAX) \
88 T(u_hyper, ULONG_LONG_MAX) \
89 T(u_hyper, 0xdeadbeefdeadbeefULL) \
90 T(u_hyper, 0x12312345678ULL) \
91 T(u_hyper, 0x12387654321ULL) \
93 T(longlong_t, CHAR_MAX) \
94 T(longlong_t, CHAR_MIN) \
95 T(longlong_t, SHRT_MAX) \
96 T(longlong_t, SHRT_MIN) \
97 T(longlong_t, INT_MAX) \
98 T(longlong_t, INT_MIN) \
99 T(longlong_t, LONG_MAX) \
100 T(longlong_t, LONG_MIN) \
101 T(longlong_t, LONG_LONG_MAX) \
102 T(longlong_t, LONG_LONG_MIN) \
103 T(longlong_t, 0x12312345678LL) \
104 T(longlong_t, 0x12387654321LL) \
106 T(u_longlong_t, UCHAR_MAX) \
107 T(u_longlong_t, USHRT_MAX) \
108 T(u_longlong_t, UINT_MAX) \
109 T(u_longlong_t, ULONG_MAX) \
110 T(u_longlong_t, ULONG_LONG_MAX) \
111 T(u_longlong_t, 0xdeadbeefdeadbeefULL)\
112 T(u_longlong_t, 0x12312345678ULL) \
113 T(u_longlong_t, 0x12387654321ULL) \
120 T(u_short, UCHAR_MAX) \
121 T(u_short, USHRT_MAX) \
128 T(u_char, UCHAR_MAX) \
141 S(wrapstring, (char *) "") \
142 S(wrapstring, (char *) "hello, world")
144 #define T(type, val) \
146 if (! xdr_##type (&xdrs, &v_##type)) \
148 puts ("encoding of " #type \
149 " " #val " failed"); \
152 #define S(type, val) T(type, val)
160 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_DECODE
);
162 #define T(type, val) \
164 if (! xdr_##type (&xdrs, &v_##type)) \
166 puts ("decoding of " #type \
167 " " #val " failed"); \
170 if (v_##type != val) \
172 puts ("decoded value differs, " \
173 "type " #type " " #val); \
176 #define S(type, val) \
178 if (! xdr_##type (&xdrs, &v_##type)) \
180 puts ("decoding of " #type \
181 " " #val " failed"); \
184 if (strcmp (v_##type, val)) \
186 puts ("decoded value differs, " \
187 "type " #type " " #val); \
202 #define TEST_FUNCTION do_test ()
203 #include "../test-skeleton.c"