Last change
on this file since 8991 was
8991,
checked in by gz, 11 years ago

Check in the gcl ansi test suite (original, in preparation for making local changes)

File size:
1.9 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sun Apr 20 07:38:18 2003 

4  ;;;; Contains: Tests of REMF 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "consaux.lsp") 

9  

10  (deftest remf.1 

11  (let ((x nil)) 

12  (values (remf x 'a) x)) 

13  nil ()) 

14  

15  (deftest remf.2 

16  (let ((x (list 'a 'b))) 

17  (values (not (null (remf x 'a))) x)) 

18  t ()) 

19  

20  (deftest remf.3 

21  (let ((x (list 'a 'b 'a 'c))) 

22  (values (not (null (remf x 'a))) x)) 

23  t (a c)) 

24  

25  (deftest remf.4 

26  (let ((x (list 'a 'b 'c 'd))) 

27  (values 

28  (and (remf x 'c) t) 

29  (loop 

30  for ptr on x by #'cddr count 

31  (not (eqt (car ptr) 'a))))) 

32  t 0) 

33  

34  ;;; Test that explicit calls to macroexpand in subforms 

35  ;;; are done in the correct environment 

36  

37  (deftest remf.5 

38  (macrolet 

39  ((%m (z) z)) 

40  (let ((x nil)) 

41  (values 

42  (remf (expandincurrentenv (%m x)) 'a) 

43  x))) 

44  nil nil) 

45  

46  (deftest remf.6 

47  (macrolet 

48  ((%m (z) z)) 

49  (let ((x (list 'a 'b))) 

50  (values 

51  (notnot (remf (expandincurrentenv (%m x)) 'a)) 

52  x))) 

53  t nil) 

54  

55  (deftest remf.7 

56  (macrolet 

57  ((%m (z) z)) 

58  (let ((x (list 'a 'b 'c 'd))) 

59  (values 

60  (notnot (remf x (expandincurrentenv (%m 'a)))) 

61  x))) 

62  t (c d)) 

63  

64  

65  

66  (deftest remf.order.1 

67  (let ((i 0) x y 

68  (p (makearray 1 :initialelement (copylist '(a b c d e f))))) 

69  (values 

70  (notnot 

71  (remf (aref p (progn (setf x (incf i)) 0)) 

72  (progn (setf y (incf i)) 

73  'c))) 

74  (aref p 0) 

75  i x y)) 

76  t (a b e f) 2 1 2) 

77  

78  (deftest remf.order.2 

79  (let ((x (copyseq #(nil :a :b))) 

80  (pa (vector (list :a 1) (list :b 2) (list :c 3) (list :d 4))) 

81  (i 0)) 

82  (values 

83  (not (remf (aref pa (incf i)) (aref x (incf i)))) 

84  pa)) 

85  nil #((:a 1) nil (:c 3) (:d 4))) 

86  

87  (deftest remf.order.3 

88  (let ((x (list 'a 'b 'c 'd))) 

89  (progn 

90  "See CLtS 5.1.3" 

91  (values 

92  (remf x (progn (setq x (list 'e 'f)) 'a)) 

93  x))) 

94  nil (e f)) 

95  

96  (defmacrotest remf.error.1 (remf x 'a)) 

Note: See
TracBrowser
for help on using the repository browser.