comparison src/tests.c @ 5027:22179cd0fe15

merge
author Ben Wing <ben@xemacs.org>
date Wed, 10 Feb 2010 07:25:19 -0600
parents ae48681c47fa
children e70a73f9243d
comparison
equal deleted inserted replaced
5026:46cf825f6158 5027:22179cd0fe15
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 Copyright (C) 2001, 2002, 2010 Ben Wing.
4 Copyright (C) 2006 The Free Software Foundation, Inc. 4 Copyright (C) 2006 The Free Software Foundation, Inc.
5 5
6 This file is part of XEmacs. 6 This file is part of XEmacs.
7 7
8 XEmacs is free software; you can redistribute it and/or modify it 8 XEmacs is free software; you can redistribute it and/or modify it
643 hash_result); 643 hash_result);
644 644
645 return hash_result; 645 return hash_result;
646 } 646 }
647 647
648 DEFUN ("test-store-void-in-lisp", Ftest_store_void_in_lisp, 0, 0, "", /*
649 Test STORE_VOID_IN_LISP and its inverse GET_VOID_FROM_LISP.
650 Tests by internal assert(); only returns if it succeeds.
651 */
652 ())
653 {
654 struct foobar { int x; int y; short z; void *q; } baz;
655
656 #define FROB(val) \
657 do \
658 { \
659 void *pval = (void *) (val); \
660 assert (GET_VOID_FROM_LISP (STORE_VOID_IN_LISP (pval)) == pval); \
661 } \
662 while (0)
663 assert (INT_VALBITS >= 31);
664 FROB (&baz);
665 FROB (&baz.x);
666 FROB (&baz.y);
667 FROB (&baz.z);
668 FROB (&baz.q);
669 FROB (0);
670 FROB (2);
671 FROB (&Vtest_function_list);
672 FROB (0x00000080);
673 FROB (0x00008080);
674 FROB (0x00808080);
675 FROB (0x80808080);
676 FROB (0xCAFEBABE);
677 FROB (0xFFFFFFFE);
678 #if INT_VALBITS >= 63
679 FROB (0x0000808080808080);
680 FROB (0x8080808080808080);
681 FROB (0XDEADBEEFCAFEBABE);
682 FROB (0XFFFFFFFFFFFFFFFE);
683 #endif /* INT_VALBITS >= 63 */
684
685 return list3 (build_ascstring ("STORE_VOID_IN_LISP"), Qt, Qnil);
686 }
687
648 688
649 689
650 #ifdef NEW_GC 690 #ifdef NEW_GC
651 #define TESTS_DEFSUBR(Fname) do { \ 691 #define TESTS_DEFSUBR(Fname) do { \
652 DEFSUBR_MC_ALLOC (Fname); \ 692 DEFSUBR_MC_ALLOC (Fname); \
669 { 709 {
670 Vtest_function_list = Qnil; 710 Vtest_function_list = Qnil;
671 711
672 TESTS_DEFSUBR (Ftest_data_format_conversion); 712 TESTS_DEFSUBR (Ftest_data_format_conversion);
673 TESTS_DEFSUBR (Ftest_hash_tables); 713 TESTS_DEFSUBR (Ftest_hash_tables);
714 TESTS_DEFSUBR (Ftest_store_void_in_lisp);
674 /* Add other test functions here with TESTS_DEFSUBR */ 715 /* Add other test functions here with TESTS_DEFSUBR */
675 } 716 }
676 717
677 void 718 void
678 vars_of_tests (void) 719 vars_of_tests (void)