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

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sun Aug 31 10:39:01 2003 

4  ;;;; Contains: Tests of EVENP 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "numbersaux.lsp") 

9  

10  (deftest evenp.error.1 

11  (signalserror (evenp) programerror) 

12  t) 

13  

14  (deftest evenp.error.2 

15  (signalserror (evenp 0 nil) programerror) 

16  t) 

17  

18  (deftest evenp.error.3 

19  (checktypeerror #'evenp #'integerp) 

20  nil) 

21  

22  (deftest evenp.1 

23  (loop for x in *numbers* 

24  when (integerp x) 

25  do (evenp x)) 

26  nil) 

27  

28  (deftest evenp.3 

29  (loop for x = (randomfixnum) 

30  repeat 10000 

31  when (or 

32  (not (evenp (+ x x))) 

33  (evenp (+ x x 1)) 

34  (if (evenp x) 

35  (or (evenp (1+ x)) 

36  (evenp (1 x)) 

37  (/= (mod x 2) 0)) 

38  (or (not (evenp (1+ x))) 

39  (not (evenp (1 x))) 

40  (= (mod x 2) 0)))) 

41  collect x) 

42  nil) 

43  

44  (deftest evenp.4 

45  (let ((upperbound 1000000000000000) 

46  (lowerbound 1000000000000000)) 

47  (loop for x = (randomfrominterval upperbound lowerbound) 

48  repeat 10000 

49  when (or 

50  (not (evenp (+ x x))) 

51  (evenp (+ x x 1)) 

52  (if (evenp x) 

53  (or (evenp (1+ x)) 

54  (evenp (1 x)) 

55  (/= (mod x 2) 0)) 

56  (or (not (evenp (1+ x))) 

57  (not (evenp (1 x))) 

58  (= (mod x 2) 0)))) 

59  collect x)) 

60  nil) 

61  

62  (deftest evenp.5 

63  (notnotmv (evenp 0)) 

64  t) 

65  

66  (deftest evenp.6 

67  (evenp 1) 

68  nil) 

69  

70  (deftest evenp.7 

71  (notnotmv (evenp 100000000000000000000000000000000)) 

72  t) 

73  

74  (deftest evenp.8 

75  (evenp 100000000000000000000000000000001) 

76  nil) 

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