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 May 29 08:25:46 2005 

4  ;;;; Contains: Tests of TYPE declarations 

5  

6  (inpackage :cltest) 

7  

8  ;;; Also of implicit type declarations 

9  

10  (deftest type.1 

11  (let ((x 1)) 

12  (declare (type (integer 0 1) x)) 

13  (values 

14  x 

15  (setq x 0) 

16  (1+ x))) 

17  1 0 1) 

18  

19  (deftest type.2 

20  (let ((x 1)) 

21  (declare (type (integer 1 1) x)) 

22  (locally (declare (type (integer 0 2) x)) 

23  (values 

24  x 

25  (setq x 0) 

26  (1+ x)))) 

27  1 0 1) 

28  

29  (deftest type.3 

30  (loop for x in *miniuniverse* 

31  for tp = (typeof x) 

32  for form = `(let ((y ',x)) 

33  (declare (type ,tp y)) 

34  y) 

35  for val = (eval form) 

36  unless (eql val x) 

37  collect (list x tp form val)) 

38  nil) 

39  

40  (deftest type.4 

41  (loop for x in *miniuniverse* 

42  for tp = (typeof x) 

43  for form = `(let ((y ',x)) 

44  (declare (,tp y)) 

45  y) 

46  for val = (eval form) 

47  unless (eql val x) 

48  collect (list x tp form val)) 

49  nil) 

50  

51  (deftest type.5 

52  (loop for x in *miniuniverse* 

53  for class = (classof x) 

54  for form = `(let ((y ',x)) 

55  (declare (,class y)) 

56  y) 

57  for val = (eval form) 

58  unless (eql val x) 

59  collect (list x class form val)) 

60  nil) 

61  

62  ;;; Free TYPE declaration 

63  ;;; It should not apply to the occurence of X in the form 

64  ;;; whose value is being bound to Y. 

65  

66  (deftest type.6 

67  (let ((x 2)) 

68  (let ((y (+ (decf x) 2))) 

69  (declare (type (integer 0 1) x)) 

70  (values x y))) 

71  1 3) 

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