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

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

File size:
1.5 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sun Apr 20 15:43:44 2003 

4  ;;;; Contains: Tests of SHIFTF 

5  

6  (inpackage :cltest) 

7  

8  (deftest shiftforder.1 

9  (let ((x (vector 'a 'b 'c 'd 'e)) 

10  (i 2)) 

11  (values (shiftf (aref x (incf i)) (incf i)) x i)) 

12  d #(a b c 4 e) 4) 

13  

14  (deftest shiftforder.2 

15  (let ((x (vector 'a 'b 'c 'd 'e 'f 'g 'h)) 

16  (i 2)) 

17  (values (shiftf (aref x (incf i)) (aref x (incf i)) (incf i)) x i)) 

18  d #(a b c e 5 f g h) 5) 

19  

20  (deftest shiftf.1 

21  (let ((x 0)) 

22  (values 

23  x 

24  (shiftf x 1) 

25  x)) 

26  0 0 1) 

27  

28  (deftest shiftf.2 

29  (let ((x 'a) (y 'b) (z 'c)) 

30  (values 

31  x y z 

32  (shiftf x y z 'd) 

33  x y z)) 

34  a b c 

35  a 

36  b c d) 

37  

38  (deftest shiftf.3 

39  (let ((x (vector 0 1 2 3))) 

40  (values 

41  (copyseq x) 

42  (shiftf (aref x (aref x 0)) 

43  (aref x (aref x 1)) 

44  (aref x (aref x 2)) 

45  (aref x (aref x 3)) 

46  'foo) 

47  (copyseq x))) 

48  #(0 1 2 3) 

49  0 

50  #(1 2 3 foo)) 

51  

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

53  ;;; are done in the correct environment 

54  

55  (deftest shiftf.4 

56  (macrolet 

57  ((%m (z) z)) 

58  (let ((x 1) (y 2)) 

59  (values 

60  (shiftf (expandincurrentenv (%m x)) y 'foo) 

61  x y))) 

62  1 2 foo) 

63  

64  (deftest shiftf.5 

65  (macrolet 

66  ((%m (z) z)) 

67  (let ((x 1) (y 2)) 

68  (values 

69  (shiftf x (expandincurrentenv (%m y)) 'foo) 

70  x y))) 

71  1 2 foo) 

72  

73  (deftest shiftf.6 

74  (macrolet 

75  ((%m (z) z)) 

76  (let ((x 1) (y 2)) 

77  (values 

78  (shiftf x y (expandincurrentenv (%m 'foo))) 

79  x y))) 

80  1 2 foo) 

81  

82  ;;; Need to add more shiftf tests here 

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