Merge buffer.lisp into stream.lisp
[iolib.git] / tests / base.lisp
blobbf2717b866e82f31e52e812a9cbf1141eb7ec42d
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; indent-tabs-mode: nil -*-
2 ;;;
3 ;;; --- iolib.base test suite.
4 ;;;
6 (in-package :iolib-tests)
8 (in-suite* :iolib.base :in :iolib)
10 ;;;; SPLIT-SEQUENCE
12 (test split-sequence.1
13 (is (equalp (split-sequence #\; "a;;b;c")
14 (values '("a" "" "b" "c") 6))))
16 (test split-sequence.2
17 (is (equalp (split-sequence #\; "a;;b;c" :from-end t)
18 (values '("a" "" "b" "c") 0))))
20 (test split-sequence.3
21 (is (equalp (split-sequence #\; "a;;b;c" :from-end t :count 1)
22 (values '("c") 4))))
24 (test split-sequence.4
25 (is (equalp (split-sequence #\; "a;;b;c" :remove-empty-subseqs t)
26 (values '("a" "b" "c") 6))))
28 (test split-sequence.5
29 (is (equalp (split-sequence-if (lambda (x) (member x '(#\a #\b))) "abracadabra")
30 (values '("" "" "r" "c" "d" "" "r" "") 11))))
32 (test split-sequence.6
33 (is (equalp (split-sequence-if-not (lambda (x) (member x '(#\a #\b))) "abracadabra")
34 (values '("ab" "a" "a" "ab" "a") 11))))
36 (test split-sequence.7
37 (is (equalp (split-sequence #\; ";oo;bar;ba;" :start 1 :end 9)
38 (values '("oo" "bar" "b") 9))))