source: trunk/source/tests/ansi-tests/lognot.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: 862 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Sep  9 06:16:20 2003
4;;;; Contains: Tests of LOGNOT
5
6(in-package :cl-test)
7
8(compile-and-load "numbers-aux.lsp")
9
10;;; Error tests
11
12(deftest lognot.error.1
13  (check-type-error #'lognot #'integerp)
14  nil)
15
16(deftest lognot.error.2
17  (signals-error (lognot) program-error)
18  t)
19
20(deftest lognot.error.3
21  (signals-error (lognot 0 0) program-error)
22  t)
23
24;;; Non-error tests
25
26(deftest lognot.1
27  (lognot 0)
28  -1)
29
30(deftest lognot.2
31  (lognot -1)
32  0)
33
34(deftest lognot.3
35  (lognot 123)
36  -124)
37
38(deftest lognot.4
39  (loop for x = (random-from-interval (ash 1 (random 200)))
40        for z = (lognot x)
41        repeat 1000
42        unless (and (if (>= x 0) (< z 0) (>= z 0))
43                    (loop for i from 1 to 210
44                          always (if (not (logbitp i x))
45                                     (logbitp i z)
46                                   (not (logbitp i z)))))
47        collect (list x z))
48  nil)
Note: See TracBrowser for help on using the repository browser.