~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to ansi-tests/print-bit-vector.lsp

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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)