source: trunk/source/tests/ansi-tests/logtest.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: 969 bytes
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Thu Sep 11 23:22:46 2003
4;;;; Contains: Tests for LOGTEST
5
6(in-package :cl-test)
7
8;;; Error tests
9
10(deftest logtest.error.1
11  (signals-error (logtest) program-error)
12  t)
13
14(deftest logtest.error.2
15  (signals-error (logtest 0) program-error)
16  t)
17
18(deftest logtest.error.3
19  (signals-error (logtest 0 0 nil) program-error)
20  t)
21
22(deftest logtest.error.4
23  (check-type-error #'(lambda (x) (logtest x -1)) #'integerp)
24  nil)
25
26(deftest logtest.error.5
27  (check-type-error #'(lambda (x) (logtest -1 x)) #'integerp)
28  nil)
29
30;;; Non-error tests
31
32(deftest logtest.1
33  (loop for x = (logand (random-fixnum) (random-fixnum))
34        for y = (logand (random-fixnum) (random-fixnum))
35        repeat 10000
36        unless (if (logtest x y)
37                   (not (zerop (logand x y)))
38                 (zerop (logand x y)))
39        collect (list x y))
40  nil)
41
42(deftest logtest.2
43  (logtest 1 2)
44  nil)
45
46(deftest logtest.3
47  (notnot-mv (logtest 8 (logior 8 4)))
48  t)
49 
50
51 
Note: See TracBrowser for help on using the repository browser.