source: trunk/source/tests/ansi-tests/real.lsp @ 8991

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.4 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Sun Oct 31 21:41:49 2004
4;;;; Contains: Additional tests of the REAL type specifier
5
6(in-package :cl-test)
7
8(deftest real.1
9  (loop for i = 1 then (ash i 1)
10        for tp = `(real 0 ,i)
11        repeat 200
12        unless (and (not (typep -1 tp))
13                    (not (typep -0.0001 tp))
14                    (typep 0 tp)
15                    (typep 0.0001 tp)
16                    (typep 1 tp)
17                    (typep i tp)
18                    (not (typep (1+ i) tp)))
19        collect (list i tp))
20  nil)
21
22(deftest real.2
23  (loop for i = 1 then (ash i 1)
24        for tp = `(real ,(- i) 0)
25        repeat 200
26        unless (and (not (typep (- -1 i) tp))
27                    (typep (- i) tp)
28                    (typep -1 tp)
29                    (typep 0 tp)
30                    (not (typep 1 tp))
31                    (not (typep i tp))
32                    (not (typep (1+ i) tp)))
33        collect (list i tp))
34  nil)
35
36(deftest real.3
37  (loop for i = 4 then (ash i 1)
38        for tp = `(real 0 ,(/ i 3))
39        repeat 200
40        unless (and (not (typep -1 tp))
41                    (not (typep -0.0001 tp))
42                    (typep 0 tp)
43                    (typep 0.0001 tp)
44                    (typep 1 tp)
45                    (typep (/ i 3) tp)
46                    (not (typep (/ (1+ i) 3) tp)))
47        collect (list i tp))
48  nil)
49
50(deftest real.4
51  (loop for i = 4 then (ash i 1)
52        for tp = `(real ,(- (/ i 3)) 0)
53        repeat 200
54        unless (and (not (typep (- -1 (/ i 3)) tp))
55                    (typep (- (/ i 3)) tp)
56                    (typep -1 tp)
57                    (typep 0 tp)
58                    (not (typep 1 tp))
59                    (not (typep (/ i 3) tp))
60                    (not (typep (1+ (/ i 3)) tp)))
61        collect (list i tp))
62  nil)
Note: See TracBrowser for help on using the repository browser.