comparison src/tests.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children 6728e641994e
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
1 /* C support for testing XEmacs - see tests/automated/c-tests.el 1 /* C support for testing XEmacs - see tests/automated/c-tests.el
2 Copyright (C) 2000 Martin Buchholz 2 Copyright (C) 2000 Martin Buchholz
3 Copyright (C) 2001, 2002 Ben Wing.
3 4
4 This file is part of XEmacs. 5 This file is part of XEmacs.
5 6
6 XEmacs is free software; you can redistribute it and/or modify it 7 XEmacs is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
50 Extbyte ext_mac[] = "\r\rfoo\rbar"; 51 Extbyte ext_mac[] = "\r\rfoo\rbar";
51 Lisp_Object opaque_dos = make_opaque (ext_dos, sizeof (ext_dos) - 1); 52 Lisp_Object opaque_dos = make_opaque (ext_dos, sizeof (ext_dos) - 1);
52 Lisp_Object string_foo = make_string (int_foo, sizeof (int_foo) - 1); 53 Lisp_Object string_foo = make_string (int_foo, sizeof (int_foo) - 1);
53 54
54 Extbyte ext_latin[] = "f\372b\343\340"; 55 Extbyte ext_latin[] = "f\372b\343\340";
55 Intbyte int_latin1[] = "f\201\372b\201\343\201\340"; 56 Intbyte int_latin1[] = "f\200\372b\200\343\200\340";
56 Intbyte int_latin2[] = "f\202\372b\202\343\202\340"; 57 Intbyte int_latin2[] = "f\201\372b\201\343\201\340";
57 #ifdef MULE 58 #ifdef MULE
58 Extbyte ext_latin12[]= "f\033-A\372b\343\340\033-B"; 59 Extbyte ext_latin12[]= "f\033-A\372b\343\340\033-B";
59 Extbyte ext_tilde[] = "f~b~~"; 60 Extbyte ext_tilde[] = "f~b~~";
60 Lisp_Object string_latin2 = make_string (int_latin2, sizeof (int_latin2) - 1); 61 Lisp_Object string_latin2 = make_string (int_latin2, sizeof (int_latin2) - 1);
61 #endif 62 #endif
62 Lisp_Object opaque_latin = make_opaque (ext_latin, sizeof (ext_latin) - 1); 63 Lisp_Object opaque_latin = make_opaque (ext_latin, sizeof (ext_latin) - 1);
63 Lisp_Object opaque0_latin = make_opaque (ext_latin, sizeof (ext_latin)); 64 Lisp_Object opaque0_latin = make_opaque (ext_latin, sizeof (ext_latin));
64 Lisp_Object string_latin1 = make_string (int_latin1, sizeof (int_latin1) - 1); 65 Lisp_Object string_latin1 = make_string (int_latin1, sizeof (int_latin1) - 1);
65 66
66 /* Check for expected strings before and after conversion. 67 /* Check for expected strings before and after conversion.
67 Conversions depend on whether MULE is defined, 68 Conversions depend on whether MULE is defined. */
68 and on whether FILE_CODING is defined. */
69 #ifdef MULE 69 #ifdef MULE
70 #define DFC_CHECK_DATA_COND_MULE(ptr,len, \ 70 #define DFC_CHECK_DATA_COND_MULE(ptr,len, \
71 constant_string_mule, \ 71 constant_string_mule, \
72 constant_string_non_mule) \ 72 constant_string_non_mule) \
73 DFC_CHECK_DATA (ptr, len, constant_string_mule) 73 DFC_CHECK_DATA (ptr, len, constant_string_mule)
84 constant_string_mule, \ 84 constant_string_mule, \
85 constant_string_non_mule) \ 85 constant_string_non_mule) \
86 DFC_CHECK_DATA_NUL (ptr, len, constant_string_non_mule) 86 DFC_CHECK_DATA_NUL (ptr, len, constant_string_non_mule)
87 #endif 87 #endif
88 88
89 #ifdef FILE_CODING
90 #define DFC_CHECK_DATA_COND_EOL(ptr,len, \ 89 #define DFC_CHECK_DATA_COND_EOL(ptr,len, \
91 constant_string_eol, \ 90 constant_string_eol, \
92 constant_string_non_eol) \ 91 constant_string_non_eol) \
93 DFC_CHECK_DATA (ptr, len, constant_string_eol) 92 DFC_CHECK_DATA (ptr, len, constant_string_eol)
94 #define DFC_CHECK_DATA_COND_EOL_NUL(ptr,len, \ 93 #define DFC_CHECK_DATA_COND_EOL_NUL(ptr,len, \
95 constant_string_eol, \ 94 constant_string_eol, \
96 constant_string_non_eol) \ 95 constant_string_non_eol) \
97 DFC_CHECK_DATA_NUL (ptr, len, constant_string_eol) 96 DFC_CHECK_DATA_NUL (ptr, len, constant_string_eol)
98 #else
99 #define DFC_CHECK_DATA_COND_EOL(ptr,len, \
100 constant_string_eol, \
101 constant_string_non_eol) \
102 DFC_CHECK_DATA (ptr, len, constant_string_non_eol)
103 #define DFC_CHECK_DATA_COND_EOL_NUL(ptr,len, \
104 constant_string_eol, \
105 constant_string_non_eol) \
106 DFC_CHECK_DATA_NUL (ptr, len, constant_string_non_eol)
107 #endif
108 97
109 /* Check for expected strings before and after conversion. */ 98 /* Check for expected strings before and after conversion. */
110 #define DFC_CHECK_DATA(ptr,len, constant_string) do { \ 99 #define DFC_CHECK_DATA(ptr,len, constant_string) do { \
111 assert ((len) == sizeof (constant_string) - 1); \ 100 assert ((len) == sizeof (constant_string) - 1); \
112 assert (!memcmp (ptr, constant_string, len)); \ 101 assert (!memcmp (ptr, constant_string, len)); \
120 109
121 #ifdef MULE 110 #ifdef MULE
122 ptr = NULL, len = rand(); 111 ptr = NULL, len = rand();
123 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)), 112 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
124 ALLOCA, (ptr, len), 113 ALLOCA, (ptr, len),
125 Fget_coding_system (intern ("iso-8859-2"))); 114 intern ("iso-8859-2"));
126 DFC_CHECK_DATA_NUL (ptr, len, ext_latin); 115 DFC_CHECK_DATA_NUL (ptr, len, ext_latin);
127 116
128 ptr = NULL, len = rand(); 117 ptr = NULL, len = rand();
129 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin2, 118 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin2,
130 ALLOCA, (ptr, len), 119 ALLOCA, (ptr, len),
131 Fget_coding_system (intern ("iso-8859-2"))); 120 intern ("iso-8859-2"));
132 DFC_CHECK_DATA (ptr, len, ext_latin); 121 DFC_CHECK_DATA (ptr, len, ext_latin);
133 122
134 ptr = NULL, len = rand(); 123 ptr = NULL, len = rand();
135 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1, 124 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
136 ALLOCA, (ptr, len), 125 ALLOCA, (ptr, len),
137 Fget_coding_system (intern ("iso-8859-2"))); 126 intern ("iso-8859-2"));
138 DFC_CHECK_DATA (ptr, len, ext_latin12); 127 DFC_CHECK_DATA (ptr, len, ext_latin12);
139 128
140 ptr = NULL, len = rand(); 129 ptr = NULL, len = rand();
141 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1), 130 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
142 MALLOC, (ptr, len), 131 MALLOC, (ptr, len),
143 Fget_coding_system (intern ("iso-8859-2"))); 132 intern ("iso-8859-2"));
144 DFC_CHECK_DATA (ptr, len, ext_latin); 133 DFC_CHECK_DATA (ptr, len, ext_latin);
145 xfree (ptr); 134 xfree (ptr);
146 135
147 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1), 136 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
148 LISP_OPAQUE, opaque, 137 LISP_OPAQUE, opaque,
149 Fget_coding_system (intern ("iso-8859-2"))); 138 intern ("iso-8859-2"));
150 DFC_CHECK_DATA (XOPAQUE_DATA (opaque), XOPAQUE_SIZE (opaque), ext_latin); 139 DFC_CHECK_DATA (XOPAQUE_DATA (opaque), XOPAQUE_SIZE (opaque), ext_latin);
151 140
152 ptr = NULL, len = rand(); 141 ptr = NULL, len = rand();
153 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1), 142 TO_INTERNAL_FORMAT (DATA, (ext_latin, sizeof (ext_latin) - 1),
154 ALLOCA, (ptr, len), 143 ALLOCA, (ptr, len),
209 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_latin, int_latin1); 198 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_latin, int_latin1);
210 199
211 ptr = NULL, len = rand(); 200 ptr = NULL, len = rand();
212 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1), 201 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2) - 1),
213 ALLOCA, (ptr, len), 202 ALLOCA, (ptr, len),
214 Fget_coding_system (Qbinary)); 203 Qbinary);
215 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_tilde, int_latin2); 204 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_tilde, int_latin2);
216 205
217 ptr = NULL, len = rand(); 206 ptr = NULL, len = rand();
218 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1), 207 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
219 ALLOCA, (ptr, len), 208 ALLOCA, (ptr, len),
228 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1); 217 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
229 218
230 ptr = NULL, len = rand(); 219 ptr = NULL, len = rand();
231 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1, 220 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
232 ALLOCA, (ptr, len), 221 ALLOCA, (ptr, len),
233 Fget_coding_system (Qbinary)); 222 Qbinary);
234 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1); 223 DFC_CHECK_DATA_COND_MULE (ptr, len, ext_latin, int_latin1);
235 224
236 ptr = NULL, len = rand(); 225 ptr = NULL, len = rand();
237 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1, 226 TO_EXTERNAL_FORMAT (LISP_STRING, string_latin1,
238 ALLOCA, (ptr, len), 227 ALLOCA, (ptr, len),
247 xfree (ptr); 236 xfree (ptr);
248 237
249 ptr = NULL, len = rand(); 238 ptr = NULL, len = rand();
250 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)), 239 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
251 MALLOC, (ptr, len), 240 MALLOC, (ptr, len),
252 Fget_coding_system (Qbinary)); 241 Qbinary);
253 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_tilde, int_latin2); 242 DFC_CHECK_DATA_COND_MULE_NUL (ptr, len, ext_tilde, int_latin2);
254 xfree (ptr); 243 xfree (ptr);
255 244
256 ptr = NULL, len = rand(); 245 ptr = NULL, len = rand();
257 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1), 246 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
266 DFC_CHECK_DATA_COND_MULE (XOPAQUE_DATA (opaque), 255 DFC_CHECK_DATA_COND_MULE (XOPAQUE_DATA (opaque),
267 XOPAQUE_SIZE (opaque), ext_latin, int_latin1); 256 XOPAQUE_SIZE (opaque), ext_latin, int_latin1);
268 257
269 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)), 258 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
270 LISP_OPAQUE, opaque, 259 LISP_OPAQUE, opaque,
271 Fget_coding_system (Qbinary)); 260 Qbinary);
272 DFC_CHECK_DATA_COND_MULE_NUL (XOPAQUE_DATA (opaque), 261 DFC_CHECK_DATA_COND_MULE_NUL (XOPAQUE_DATA (opaque),
273 XOPAQUE_SIZE (opaque), ext_tilde, int_latin2); 262 XOPAQUE_SIZE (opaque), ext_tilde, int_latin2);
274 263
275 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1), 264 TO_EXTERNAL_FORMAT (DATA, (int_latin1, sizeof (int_latin1) - 1),
276 LISP_OPAQUE, opaque, 265 LISP_OPAQUE, opaque,
324 313
325 314
326 ptr = NULL, len = rand(); 315 ptr = NULL, len = rand();
327 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)), 316 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)),
328 MALLOC, (ptr, len), 317 MALLOC, (ptr, len),
329 Fget_coding_system (Qbinary)); 318 Qbinary);
330 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo); 319 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo);
331 xfree (ptr); 320 xfree (ptr);
332 321
333 ptr = NULL, len = rand(); 322 ptr = NULL, len = rand();
334 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1), 323 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1),
357 xfree (ptr); 346 xfree (ptr);
358 347
359 ptr = NULL, len = rand(); 348 ptr = NULL, len = rand();
360 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1), 349 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo) - 1),
361 ALLOCA, (ptr, len), 350 ALLOCA, (ptr, len),
362 Fget_coding_system (intern ("no-conversion-dos"))); 351 intern ("no-conversion-dos"));
363 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_dos, int_foo); 352 DFC_CHECK_DATA_COND_EOL (ptr, len, ext_dos, int_foo);
364 353
365 ptr = NULL, len = rand(); 354 ptr = NULL, len = rand();
366 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)), 355 TO_EXTERNAL_FORMAT (DATA, (int_foo, sizeof (int_foo)),
367 ALLOCA, (ptr, len), 356 ALLOCA, (ptr, len),
368 intern ("no-conversion-unix")); 357 intern ("no-conversion-unix"));
369 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo); 358 DFC_CHECK_DATA_COND_EOL_NUL (ptr, len, ext_unix, int_foo);
370 359
371 #ifdef FILE_CODING
372 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_dos, 360 TO_INTERNAL_FORMAT (LISP_OPAQUE, opaque_dos,
373 LISP_BUFFER, Fcurrent_buffer(), 361 LISP_BUFFER, Fcurrent_buffer(),
374 intern ("undecided")); 362 intern ("undecided"));
375 DFC_CHECK_DATA (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)), 363 DFC_CHECK_DATA (BUF_BYTE_ADDRESS (current_buffer, BUF_PT (current_buffer)),
376 sizeof (int_foo) - 1, int_foo); 364 sizeof (int_foo) - 1, int_foo);
377
378 #endif /* FILE_CODING */
379 365
380 TO_INTERNAL_FORMAT (DATA, (ext_mac, sizeof (ext_mac) - 1), 366 TO_INTERNAL_FORMAT (DATA, (ext_mac, sizeof (ext_mac) - 1),
381 LISP_STRING, string, 367 LISP_STRING, string,
382 intern ("iso-8859-1")); 368 intern ("iso-8859-1"));
383 DFC_CHECK_DATA_COND_EOL (XSTRING_DATA (string), 369 DFC_CHECK_DATA_COND_EOL (XSTRING_DATA (string),