source: trunk/source/tests/ansi-tests/print-bit-vector.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.7 KB
Line 
1;-*- Mode:     Lisp -*-
2;;;; Author:   Paul Dietz
3;;;; Created:  Tue Apr 20 22:10:53 2004
4;;;; Contains: Tests for printing of bit vectors
5
6(compile-and-load "printer-aux.lsp")
7
8(in-package :cl-test)
9
10(deftest print.bit-vector.1
11  (with-standard-io-syntax
12   (write-to-string #* :readably nil :escape nil))
13  "#*")
14
15(deftest print.bit-vector.2
16  (with-standard-io-syntax
17   (subseq (write-to-string #* :readably nil :escape nil :array nil)
18           0 2))
19  "#<")
20
21(deftest print.bit-vector.3
22  (with-standard-io-syntax
23   (write-to-string #*001101010011011 :readably nil :escape nil))
24  "#*001101010011011")
25
26(deftest print.bit-vector.4
27  (with-standard-io-syntax
28   (subseq (write-to-string #*11010011010110101
29                            :readably nil :escape nil :array nil)
30           0 2))
31  "#<")
32
33(deftest print.bit-vector.5
34  (let* ((bv1 #*0001100101)
35         (bv2 (make-array 5 :displaced-to bv1
36                          :displaced-index-offset 1
37                          :element-type 'bit)))
38    (with-standard-io-syntax
39     (write-to-string bv2 :readably nil :escape nil)))
40  "#*00110")
41
42(deftest print.bit-vector.6
43  (let* ((bv (make-array 10
44                         :element-type 'bit
45                         :initial-contents '(1 0 0 1 0 0 1 1 1 0)
46                         :fill-pointer 5)))
47    (with-standard-io-syntax
48     (write-to-string bv :readably nil :escape nil)))
49  "#*10010")
50
51
52(deftest print.bit-vector.7
53  (let* ((bv (make-array 10
54                         :element-type 'bit
55                         :initial-contents '(1 0 0 1 0 0 1 1 1 0)
56                         :adjustable t)))
57    (with-standard-io-syntax
58     (write-to-string bv :readably nil :escape nil)))
59  "#*1001001110")
60
61
62
63(deftest print.bit-vector.random
64  (loop
65   for len = (random 100)
66   for bv = (coerce (loop repeat len collect (random 2)) 'bit-vector)
67   repeat 1000
68   nconc (randomly-check-readability bv))
69  nil)
Note: See TracBrowser for help on using the repository browser.