source: trunk/source/tests/ansi-tests/print-complex.lsp @ 8991

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.3 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Wed Mar  3 06:44:04 2004
4;;;; Contains: Tests of printing complex numbers
5
6(in-package :cl-test)
7
8(compile-and-load "printer-aux.lsp")
9
10(deftest print.complex.1
11  (equalt
12   (with-standard-io-syntax
13     (let ((*print-readably* nil))
14       (with-output-to-string (s) (prin1 (complex 1 2) s))))
15   "#C(1 2)")
16  t)
17
18(deftest print.complex.2
19  (equalt
20   (with-standard-io-syntax
21     (let ((*print-readably* nil))
22       (with-output-to-string (s) (prin1 (complex 1.0 2.0) s))))
23   "#C(1.0 2.0)")
24  t)
25
26(deftest print.complex.random.1
27  (loop for numbits = (random 40)
28        for bound = (ash 1 numbits)
29        for r = (- (random (+ bound bound)) bound)
30        for i = (- (random (+ bound bound)) bound)
31        repeat 1000
32        unless (= i 0)
33        nconc (randomly-check-readability (complex r i)))
34  nil)
35
36(deftest print.complex.random.2
37  (loop for numbits = (random 40)
38        for bound = (ash 1 numbits)
39        for num1 = (- (random (+ bound bound)) bound)
40        for num2 = (- (random (+ bound bound)) bound)
41        for denom1 = (1+ (random bound))
42        for denom2 = (1+ (random bound))
43        for r = (/ num1 denom1)
44        for i = (/ num2 denom2)
45        repeat 1000
46        unless (= i 0)
47        nconc (randomly-check-readability (complex r i)))
48  nil)
49
50;; General floating point complex printing tests will go here
51               
52
53
54
55
56
Note: See TracBrowser for help on using the repository browser.