comparison src/tests.c @ 4959:bd169a24a554

merge
author Ben Wing <ben@xemacs.org>
date Thu, 28 Jan 2010 04:27:30 -0600
parents 304aebb79cd3
children 16112448d484
comparison
equal deleted inserted replaced
4893:99f2102552d7 4959:bd169a24a554
146 #define DFC_INITIALIZE(test_name) if (0) 146 #define DFC_INITIALIZE(test_name) if (0)
147 147
148 #define DFC_CHECK_LENGTH(len1,len2,str1) \ 148 #define DFC_CHECK_LENGTH(len1,len2,str1) \
149 else if ((len1) != (len2)) \ 149 else if ((len1) != (len2)) \
150 conversion_result = \ 150 conversion_result = \
151 Fcons (list3 (build_string(str1), Qnil, build_string("wrong length")), \ 151 Fcons (list3 (build_cistring(str1), Qnil, build_ascstring("wrong length")), \
152 conversion_result) 152 conversion_result)
153 153
154 #define DFC_CHECK_CONTENT(str1,str2,len1,str3) \ 154 #define DFC_CHECK_CONTENT(str1,str2,len1,str3) \
155 else if (memcmp (str1, str2, len1)) \ 155 else if (memcmp (str1, str2, len1)) \
156 conversion_result = \ 156 conversion_result = \
157 Fcons (list3 (build_string(str3), Qnil, \ 157 Fcons (list3 (build_cistring(str3), Qnil, \
158 build_string("octet comparison failed")), \ 158 build_ascstring("octet comparison failed")), \
159 conversion_result) 159 conversion_result)
160 160
161 #define DFC_RESULT_PASS(str1) \ 161 #define DFC_RESULT_PASS(str1) \
162 else \ 162 else \
163 conversion_result = \ 163 conversion_result = \
164 Fcons (list3 (build_string(str1), Qt, Qnil), \ 164 Fcons (list3 (build_cistring(str1), Qt, Qnil), \
165 conversion_result) 165 conversion_result)
166 166
167 #ifdef MULE 167 #ifdef MULE
168 ptr = NULL, len = rand(); 168 ptr = NULL, len = rand();
169 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)), 169 TO_EXTERNAL_FORMAT (DATA, (int_latin2, sizeof (int_latin2)),
605 Fputhash (make_int (3), make_int (4), data.hash_table); 605 Fputhash (make_int (3), make_int (4), data.hash_table);
606 606
607 data.sum = 0; 607 data.sum = 0;
608 elisp_maphash_unsafe (test_hash_tables_mapper, 608 elisp_maphash_unsafe (test_hash_tables_mapper,
609 data.hash_table, (void *) &data); 609 data.hash_table, (void *) &data);
610 hash_result = Fcons (list3 (build_string ("simple mapper"), 610 hash_result = Fcons (list3 (build_ascstring ("simple mapper"),
611 (data.sum == 2 + 4) ? Qt : Qnil, 611 (data.sum == 2 + 4) ? Qt : Qnil,
612 build_string ("sum != 2 + 4")), 612 build_ascstring ("sum != 2 + 4")),
613 hash_result); 613 hash_result);
614 614
615 data.sum = 0; 615 data.sum = 0;
616 elisp_maphash (test_hash_tables_modifying_mapper, 616 elisp_maphash (test_hash_tables_modifying_mapper,
617 data.hash_table, (void *) &data); 617 data.hash_table, (void *) &data);
618 hash_result = Fcons (list3 (build_string ("modifying mapper"), 618 hash_result = Fcons (list3 (build_ascstring ("modifying mapper"),
619 (data.sum == 2 + 4) ? Qt : Qnil, 619 (data.sum == 2 + 4) ? Qt : Qnil,
620 build_string ("sum != 2 + 4")), 620 build_ascstring ("sum != 2 + 4")),
621 hash_result); 621 hash_result);
622 622
623 /* hash table now contains: (1, 2) (3, 4) (-1, 2*2) (-3, 2*4) */ 623 /* hash table now contains: (1, 2) (3, 4) (-1, 2*2) (-3, 2*4) */
624 624
625 data.sum = 0; 625 data.sum = 0;
626 elisp_maphash_unsafe (test_hash_tables_mapper, 626 elisp_maphash_unsafe (test_hash_tables_mapper,
627 data.hash_table, (void *) &data); 627 data.hash_table, (void *) &data);
628 hash_result = Fcons (list3 (build_string ("simple mapper"), 628 hash_result = Fcons (list3 (build_ascstring ("simple mapper"),
629 (data.sum == 3 * (2 + 4)) ? Qt : Qnil, 629 (data.sum == 3 * (2 + 4)) ? Qt : Qnil,
630 build_string ("sum != 3 * (2 + 4)")), 630 build_ascstring ("sum != 3 * (2 + 4)")),
631 hash_result); 631 hash_result);
632 632
633 /* Remove entries with negative keys, added by modifying mapper */ 633 /* Remove entries with negative keys, added by modifying mapper */
634 elisp_map_remhash (test_hash_tables_predicate, 634 elisp_map_remhash (test_hash_tables_predicate,
635 data.hash_table, 0); 635 data.hash_table, 0);
636 636
637 data.sum = 0; 637 data.sum = 0;
638 elisp_maphash_unsafe (test_hash_tables_mapper, 638 elisp_maphash_unsafe (test_hash_tables_mapper,
639 data.hash_table, (void *) &data); 639 data.hash_table, (void *) &data);
640 hash_result = Fcons (list3 (build_string ("remove negatives mapper"), 640 hash_result = Fcons (list3 (build_ascstring ("remove negatives mapper"),
641 (data.sum == 2 + 4) ? Qt : Qnil, 641 (data.sum == 2 + 4) ? Qt : Qnil,
642 build_string ("sum != 2 + 4")), 642 build_ascstring ("sum != 2 + 4")),
643 hash_result); 643 hash_result);
644 644
645 return hash_result; 645 return hash_result;
646 } 646 }
647 647