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.9 KB

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Tue Sep 9 05:55:23 2003 

4  ;;;; Contains: Tests of LOGEQV 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "numbersaux.lsp") 

9  

10  ;;; Error tests 

11  

12  (deftest logeqv.error.1 

13  (checktypeerror #'logeqv #'integerp) 

14  nil) 

15  

16  (deftest logeqv.error.2 

17  (checktypeerror #'(lambda (x) (logeqv 0 x)) #'integerp) 

18  nil) 

19  

20  ;;; Nonerror tests 

21  

22  (deftest logeqv.1 

23  (logeqv) 

24  1) 

25  

26  (deftest logeqv.2 

27  (logeqv 1231) 

28  1231) 

29  

30  (deftest logeqv.3 

31  (logeqv 198) 

32  198) 

33  

34  (deftest logeqv.4 

35  (loop for x in *integers* 

36  always (eql x (logeqv x))) 

37  t) 

38  

39  (deftest logeqv.5 

40  (loop for x in *integers* 

41  always (eql 0 (logeqv x (lognot x)))) 

42  t) 

43  

44  (deftest logeqv.6 

45  (loop for x = (randomfixnum) 

46  for xc = (lognot x) 

47  repeat 1000 

48  unless (eql 0 (logeqv x xc)) 

49  collect x) 

50  nil) 

51  

52  (deftest logeqv.7 

53  (loop for x = (randomfrominterval (ash 1 (random 200))) 

54  for y = (randomfrominterval (ash 1 (random 200))) 

55  for z = (logeqv x y) 

56  repeat 1000 

57  unless (and (if (or (and (< x 0) (< y 0)) 

58  (and (>= x 0) (>= y 0))) 

59  (< z 0) 

60  (>= z 0)) 

61  (loop for i from 1 to 210 

62  always (if (or (and (logbitp i x) 

63  (logbitp i y)) 

64  (and (not (logbitp i x)) 

65  (not (logbitp i y)))) 

66  (logbitp i z) 

67  (not (logbitp i z))))) 

68  collect (list x y z)) 

69  nil) 

70  

71  (deftest logeqv.8 

72  (loop for i from 1 to (min 256 (1 callargumentslimit)) 

73  for args = (nconc (makelist (1 i) :initialelement 1) 

74  (list 7131)) 

75  always (eql (apply #'logeqv args) 7131)) 

76  t) 

77  

78  (deftest logeqv.order.1 

79  (let ((i 0) a b) 

80  (values 

81  (logeqv (progn (setf a (incf i)) #b11011) 

82  (progn (setf b (incf i)) (lognot #b10110))) 

83  i a b)) 

84  #b1101 2 1 2) 

85  

86  

87  (deftest logeqv.order.2 

88  (let ((i 0) a b c) 

89  (values 

90  (logeqv (progn (setf a (incf i)) #b11011) 

91  (progn (setf b (incf i)) #b10110) 

92  (progn (setf c (incf i)) #b110101)) 

93  i a b c)) 

94  #b111000 3 1 2 3) 

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