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

Line  

1  ;* Mode: Lisp * 

2  ;;;; Author: Paul Dietz 

3  ;;;; Created: Sat Sep 6 18:42:15 2003 

4  ;;;; Contains: Tests of CIS 

5  

6  (inpackage :cltest) 

7  

8  (compileandload "numbersaux.lsp") 

9  

10  (deftest cis.error.1 

11  (signalserror (cis) programerror) 

12  t) 

13  

14  (deftest cis.error.2 

15  (signalserror (cis 0 nil) programerror) 

16  t) 

17  

18  (deftest cis.1 

19  (let ((result (cis 0))) 

20  (or (=t result 1) 

21  (eqlt #c(1.0 0.0)))) 

22  t) 

23  

24  (deftest cis.2 

25  (loop for x in '(0.0s0 0.0f0 0.0d0 0.0l0) 

26  for vals = (multiplevaluelist (cis x)) 

27  for c = (car vals) 

28  unless (and (= (length vals) 1) 

29  (eql c (complex (float 1 x) x))) 

30  collect (cons x vals)) 

31  nil) 

32  

33  (deftest cis.3 

34  (loop for x = (random (* 2 pi)) 

35  for c = (cis x) 

36  repeat 1000 

37  unless (and (complexp c) 

38  (approx= (imagpart c) (sin x)) 

39  (approx= (realpart c) (cos x))) 

40  collect (list x c (cos x) (sin x))) 

41  nil) 

42  

43  (deftest cis.4 

44  (loop for x = (random (coerce (* 2 pi) 'singlefloat)) 

45  for c = (cis x) 

46  repeat 1000 

47  unless (and (complexp c) 

48  (approx= (imagpart c) (sin x)) 

49  (approx= (realpart c) (cos x))) 

50  collect (list x c (cos x) (sin x))) 

51  nil) 

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