source: trunk/source/tests/ansi-tests/byte.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.5 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Thu Sep 11 20:13:22 2003
4;;;; Contains: Tests of BYTE, BYTE-SIZE, and BYTE-POSITION
5
6(in-package :cl-test)
7
8(deftest byte.error.1
9  (signals-error (byte) program-error)
10  t)
11
12(deftest byte.error.2
13  (signals-error (byte 1) program-error)
14  t)
15
16(deftest byte.error.3
17  (signals-error (byte 1 1 nil) program-error)
18  t)
19
20(deftest byte.1
21  (progn (byte 0 0) :good)
22  :good)
23
24(deftest byte.2
25  (progn (byte 1 1) :good)
26  :good)
27
28(deftest byte.3
29  (loop for i from 0 to 100
30        always
31        (loop for j from 0 to 100
32              always
33              (let ((bspec (byte i j)))
34                (and (eql i (byte-size bspec))
35                     (eql j (byte-position bspec))))))
36  t)
37
38(deftest byte.4
39  (macrolet
40   ((%m (z) z))
41   (let ((b (byte (expand-in-current-env (%m 2)) 5)))
42     (values (byte-size b) (byte-position b))))
43  2 5)
44
45(deftest byte.5
46  (macrolet
47   ((%m (z) z))
48   (let ((b (byte 31 (expand-in-current-env (%m 7)))))
49     (values (byte-size b) (byte-position b))))
50  31 7)
51
52(deftest byte-size.1
53  (macrolet ((%m (z) z)) (byte-size (expand-in-current-env (%m (byte 3 7)))))
54  3)
55
56(deftest byte-position.1
57  (macrolet ((%m (z) z)) (byte-position (expand-in-current-env (%m (byte 3 7)))))
58  7)
59
60(deftest byte-position.error.1
61  (signals-error (byte-position) program-error)
62  t)
63
64(deftest byte-position.error.2
65  (signals-error (byte-position (byte 1 1) nil)
66                 program-error)
67  t)
68
69(deftest byte-size.error.1
70  (signals-error (byte-size) program-error)
71  t)
72
73(deftest byte-size.error.2
74  (signals-error (byte-size (byte 1 1) nil) program-error)
75  t)
Note: See TracBrowser for help on using the repository browser.