Style changes.
[iolib.git] / tests / rods.lisp
blob30767c59f49100b4c6e7df8258ea4ae20555008d
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- rods test suite.
4 ;;;
6 (in-package :iolib-tests)
8 (in-suite :iolib.base.rods)
9 \f
11 (test make-rod.1
12 (is-true (typep (make-rod 1) '(rod 1))))
14 (test make-rod.2
15 (is-true (= 0 (aref (make-rod 1) 0))))
17 (test make-rod.3
18 (is-true (= 40 (aref (make-rod 1 :initial-element 40) 0))))
20 (test make-rod.error.1
21 (signals type-error
22 (make-rod -1 :initial-element 40)))
24 (test make-rod.error.2
25 (signals type-error
26 (make-rod 1 :initial-element -1)))
28 (test make-rod.error.3
29 (signals type-error
30 (make-rod 1 :initial-element rune-code-limit)))
32 (test make-rod.error.3
33 (signals type-error
34 (make-rod 1 :initial-element #\a)))
37 (test string-rod.1
38 (is-true (typep (string-rod "a") '(rod 1))))
40 (test string-rod.2
41 (is (equalp #(97) (string-rod "a"))))
43 (test string-rod.3
44 (is (equalp #(97) (string-rod #\a))))
46 (test string-rod.4
47 (is (equalp #(65) (string-rod 'a))))
50 (test rod.1
51 (is (equalp #(97) (rod (make-rod 1 :initial-element 97)))))
53 (test rod.2
54 (is (equalp #(97) (rod 97))))
56 (test rod.3
57 (is (equalp #(97) (rod #(97)))))
59 (test rod.4
60 (is (equalp #(97) (rod "a"))))
62 (test rod.5
63 (is (equalp #(97) (rod #\a))))
65 (test rod.6
66 (is (equalp #(65) (rod 'a))))
68 (test rod.7
69 (is-true
70 (let ((rod (make-rod 1 :initial-element 100)))
71 (eq rod (rod rod :new nil)))))
73 (test rod.8
74 (is-false
75 (let ((rod (make-rod 1 :initial-element 100)))
76 (eq rod (rod rod :new t)))))
78 (test rod.error.1
79 (signals type-error
80 (rod (make-hash-table))))