1 /* Copyright (C) 2005 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, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
29 unsigned char buf
[8192];
37 u_quad_t v_u_longlong_t
;
46 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_ENCODE
);
61 T(u_int, 0xdeadbeef) \
62 T(u_int, 0x12345678) \
64 T(long, 2147483647L) \
65 T(long, -2147483648L) \
66 T(long, -305419896L) \
67 T(long, -305419896L) \
69 T(u_long, 0xffffffffUL) \
70 T(u_long, 0xdeadbeefUL) \
71 T(u_long, 0x12345678UL) \
81 T(hyper, LONG_LONG_MAX) \
82 T(hyper, LONG_LONG_MIN) \
83 T(hyper, 0x12312345678LL) \
84 T(hyper, 0x12387654321LL) \
86 T(u_hyper, UCHAR_MAX) \
87 T(u_hyper, USHRT_MAX) \
88 T(u_hyper, UINT_MAX) \
89 T(u_hyper, ULONG_MAX) \
90 T(u_hyper, ULONG_LONG_MAX) \
91 T(u_hyper, 0xdeadbeefdeadbeefULL) \
92 T(u_hyper, 0x12312345678ULL) \
93 T(u_hyper, 0x12387654321ULL) \
95 T(longlong_t, CHAR_MAX) \
96 T(longlong_t, CHAR_MIN) \
97 T(longlong_t, SHRT_MAX) \
98 T(longlong_t, SHRT_MIN) \
99 T(longlong_t, INT_MAX) \
100 T(longlong_t, INT_MIN) \
101 T(longlong_t, LONG_MAX) \
102 T(longlong_t, LONG_MIN) \
103 T(longlong_t, LONG_LONG_MAX) \
104 T(longlong_t, LONG_LONG_MIN) \
105 T(longlong_t, 0x12312345678LL) \
106 T(longlong_t, 0x12387654321LL) \
108 T(u_longlong_t, UCHAR_MAX) \
109 T(u_longlong_t, USHRT_MAX) \
110 T(u_longlong_t, UINT_MAX) \
111 T(u_longlong_t, ULONG_MAX) \
112 T(u_longlong_t, ULONG_LONG_MAX) \
113 T(u_longlong_t, 0xdeadbeefdeadbeefULL)\
114 T(u_longlong_t, 0x12312345678ULL) \
115 T(u_longlong_t, 0x12387654321ULL) \
122 T(u_short, UCHAR_MAX) \
123 T(u_short, USHRT_MAX) \
130 T(u_char, UCHAR_MAX) \
143 S(wrapstring, (char *) "") \
144 S(wrapstring, (char *) "hello, world")
146 #define T(type, val) \
148 if (! xdr_##type (&xdrs, &v_##type)) \
150 puts ("encoding of " #type \
151 " " #val " failed"); \
154 #define S(type, val) T(type, val)
162 xdrmem_create (&xdrs
, (char *) buf
, sizeof (buf
), XDR_DECODE
);
164 #define T(type, val) \
166 if (! xdr_##type (&xdrs, &v_##type)) \
168 puts ("decoding of " #type \
169 " " #val " failed"); \
172 if (v_##type != val) \
174 puts ("decoded value differs, " \
175 "type " #type " " #val); \
178 #define S(type, val) \
180 if (! xdr_##type (&xdrs, &v_##type)) \
182 puts ("decoding of " #type \
183 " " #val " failed"); \
186 if (strcmp (v_##type, val)) \
188 puts ("decoded value differs, " \
189 "type " #type " " #val); \
204 #define TEST_FUNCTION do_test ()
205 #include "../test-skeleton.c"