1 /* Copyright (C) 2005-2019 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Jakub Jelinek <jakub@redhat.com>, 2005.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
28 unsigned char buf
[8192];
36 u_quad_t v_u_longlong_t
;
45 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_ENCODE
);
60 T(u_int, 0xdeadbeef) \
61 T(u_int, 0x12345678) \
63 T(long, 2147483647L) \
64 T(long, -2147483648L) \
65 T(long, -305419896L) \
66 T(long, -305419896L) \
68 T(u_long, 0xffffffffUL) \
69 T(u_long, 0xdeadbeefUL) \
70 T(u_long, 0x12345678UL) \
80 T(hyper, LONG_LONG_MAX) \
81 T(hyper, LONG_LONG_MIN) \
82 T(hyper, 0x12312345678LL) \
83 T(hyper, 0x12387654321LL) \
85 T(u_hyper, UCHAR_MAX) \
86 T(u_hyper, USHRT_MAX) \
87 T(u_hyper, UINT_MAX) \
88 T(u_hyper, ULONG_MAX) \
89 T(u_hyper, ULONG_LONG_MAX) \
90 T(u_hyper, 0xdeadbeefdeadbeefULL) \
91 T(u_hyper, 0x12312345678ULL) \
92 T(u_hyper, 0x12387654321ULL) \
94 T(longlong_t, CHAR_MAX) \
95 T(longlong_t, CHAR_MIN) \
96 T(longlong_t, SHRT_MAX) \
97 T(longlong_t, SHRT_MIN) \
98 T(longlong_t, INT_MAX) \
99 T(longlong_t, INT_MIN) \
100 T(longlong_t, LONG_MAX) \
101 T(longlong_t, LONG_MIN) \
102 T(longlong_t, LONG_LONG_MAX) \
103 T(longlong_t, LONG_LONG_MIN) \
104 T(longlong_t, 0x12312345678LL) \
105 T(longlong_t, 0x12387654321LL) \
107 T(u_longlong_t, UCHAR_MAX) \
108 T(u_longlong_t, USHRT_MAX) \
109 T(u_longlong_t, UINT_MAX) \
110 T(u_longlong_t, ULONG_MAX) \
111 T(u_longlong_t, ULONG_LONG_MAX) \
112 T(u_longlong_t, 0xdeadbeefdeadbeefULL)\
113 T(u_longlong_t, 0x12312345678ULL) \
114 T(u_longlong_t, 0x12387654321ULL) \
121 T(u_short, UCHAR_MAX) \
122 T(u_short, USHRT_MAX) \
129 T(u_char, UCHAR_MAX) \
142 S(wrapstring, (char *) "") \
143 S(wrapstring, (char *) "hello, world")
145 #define T(type, val) \
147 if (! xdr_##type (&xdrs, &v_##type)) \
149 puts ("encoding of " #type \
150 " " #val " failed"); \
153 #define S(type, val) T(type, val)
161 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_DECODE
);
163 #define T(type, val) \
165 if (! xdr_##type (&xdrs, &v_##type)) \
167 puts ("decoding of " #type \
168 " " #val " failed"); \
171 if (v_##type != val) \
173 puts ("decoded value differs, " \
174 "type " #type " " #val); \
177 #define S(type, val) \
179 if (! xdr_##type (&xdrs, &v_##type)) \
181 puts ("decoding of " #type \
182 " " #val " failed"); \
185 if (strcmp (v_##type, val)) \
187 puts ("decoded value differs, " \
188 "type " #type " " #val); \
203 #define TEST_FUNCTION do_test ()
204 #include "../test-skeleton.c"