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

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Tue Sep 9 06:14:35 2003 

4  ;;;; Contains: Tests of LOGNOR 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "numbersaux.lsp") 

9  

10  ;;; Error tests 

11  

12  (deftest lognor.error.1 

13  (checktypeerror #'(lambda (x) (lognor x 0)) #'integerp) 

14  nil) 

15  

16  (deftest lognor.error.2 

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

18  nil) 

19  

20  (deftest lognor.error.3 

21  (signalserror (lognor) programerror) 

22  t) 

23  

24  (deftest lognor.error.4 

25  (signalserror (lognor 0) programerror) 

26  t) 

27  

28  (deftest lognor.error.5 

29  (signalserror (lognor 1 2 3) programerror) 

30  t) 

31  

32  ;;; Nonerror tests 

33  

34  (deftest lognor.1 

35  (lognor 0 0) 

36  1) 

37  

38  (deftest lognor.2 

39  (lognor 0 1) 

40  0) 

41  

42  (deftest lognor.3 

43  (lognor 1 123) 

44  0) 

45  

46  (deftest lognor.4 

47  (loop for x in *integers* 

48  always (and (eql (lognot x) (lognor 0 x)) 

49  (eql (lognot x) (lognor x x)) 

50  (eql 0 (lognor (lognot x) x)) 

51  (eql 0 (lognor x (lognot x))))) 

52  t) 

53  

54  (deftest lognor.5 

55  (loop for x = (randomfixnum) 

56  for xc = (lognot x) 

57  repeat 1000 

58  unless (eql 0 (lognor xc x)) 

59  collect x) 

60  nil) 

61  

62  (deftest lognor.6 

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

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

65  for z = (lognor x y) 

66  repeat 1000 

67  unless (and (if (and (>= x 0) (>= y 0)) 

68  (< z 0) 

69  (>= z 0)) 

70  (loop for i from 1 to 210 

71  always (if (not (or (logbitp i x) 

72  (logbitp i y))) 

73  (logbitp i z) 

74  (not (logbitp i z))))) 

75  collect (list x y z)) 

76  nil) 

77  

78  (deftest lognor.order.1 

79  (let ((i 0) a b) 

80  (values 

81  (lognor (progn (setf a (incf i)) 2) 

82  (progn (setf b (incf i)) 3)) 

83  i a b)) 

84  0 2 1 2) 

85  

86  

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