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

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

File size:
1.8 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sun Jan 26 15:30:31 2003 

4  ;;;; Contains: Tests for SBIT 

5  

6  (inpackage :cltest) 

7  

8  (deftest sbit.1 

9  (sbit #*0010 2) 

10  1) 

11  

12  (deftest sbit.2 

13  (let ((a #*00000000)) 

14  (loop for i from 0 below (length a) 

15  collect (let ((b (copyseq a))) 

16  (setf (sbit b i) 1) 

17  b))) 

18  (#*10000000 

19  #*01000000 

20  #*00100000 

21  #*00010000 

22  #*00001000 

23  #*00000100 

24  #*00000010 

25  #*00000001)) 

26  

27  (deftest sbit.3 

28  (let ((a #*11111111)) 

29  (loop for i from 0 below (length a) 

30  collect (let ((b (copyseq a))) 

31  (setf (sbit b i) 0) 

32  b))) 

33  (#*01111111 

34  #*10111111 

35  #*11011111 

36  #*11101111 

37  #*11110111 

38  #*11111011 

39  #*11111101 

40  #*11111110)) 

41  

42  (deftest sbit.4 

43  (let ((a (makearray nil :elementtype 'bit :initialelement 0))) 

44  (values 

45  (aref a) 

46  (sbit a) 

47  (setf (sbit a) 1) 

48  (aref a) 

49  (sbit a))) 

50  0 0 1 1 1) 

51  

52  (deftest sbit.5 

53  (let ((a (makearray '(1 1) :elementtype 'bit :initialelement 0))) 

54  (values 

55  (aref a 0 0) 

56  (sbit a 0 0) 

57  (setf (sbit a 0 0) 1) 

58  (aref a 0 0) 

59  (sbit a 0 0))) 

60  0 0 1 1 1) 

61  

62  (deftest sbit.6 

63  (let ((a (makearray '(10 10) :elementtype 'bit :initialelement 0))) 

64  (values 

65  (aref a 5 5) 

66  (sbit a 5 5) 

67  (setf (sbit a 5 5) 1) 

68  (aref a 5 5) 

69  (sbit a 5 5))) 

70  0 0 1 1 1) 

71  

72  (deftest sbit.order.1 

73  (let ((i 0) a b) 

74  (values 

75  (sbit (progn (setf a (incf i)) #*001001) 

76  (progn (setf b (incf i)) 1)) 

77  i a b)) 

78  0 2 1 2) 

79  

80  (deftest sbit.order.2 

81  (let ((i 0) a b c 

82  (v (copyseq #*001001))) 

83  (values 

84  (setf (sbit (progn (setf a (incf i)) v) 

85  (progn (setf b (incf i)) 1)) 

86  (progn (setf c (incf i)) 1)) 

87  v i a b c)) 

88  1 #*011001 3 1 2 3) 

89  

90  (deftest sbit.error.1 

91  (signalserror (sbit) programerror) 

92  t) 

93  

94  

95  

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