File: string-test.lisp

package info (click to toggle)
cl-rsm-string 1.4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 72 kB
  • ctags: 23
  • sloc: lisp: 326; makefile: 44; sh: 28
file content (63 lines) | stat: -rw-r--r-- 1,679 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: rsm.string.test -*-
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name:          string-test.lisp
;;;; Purpose:       Regression tests for the String Utilities package, 
;;;;                rsm.string.
;;;; Author:        R. Scott McIntire
;;;; Date Started:  Aug 2003
;;;;
;;;; $Id: string-test.lisp,v 1.3 2003/09/10 22:19:26 rscottmcintire Exp $
;;;; *************************************************************************

(defpackage rsm.string.test
  (:use #:cl rsm.string #:ptester)
  (:documentation
   "Provides a test harness for the string utility code.")
  )


(in-package rsm.string.test)


;;;; RUN THE TESTS.


(defun run-string-tests ()

  (with-tests (:name "STRING TESTS")
    (test (list 123 t)
          (string->number "123")
          :multiple-values t
          :test #'equal
          :fail-info "Test 1")
    
    (test (list "abc" "def" "ghi")
          (split "abc def ghi")
          :test #'equal
          :fail-info "Test 2")
    
    (test "abc_def_ghi"
          (join '("abc" "def" "ghi") :join-string "_")
          :test #'equal
          :fail-info "Test 3")
    
    (test (list "abc" "ghi")
          (contains '("abc" "def" "ghi") '("bc" "gh"))
          :test #'equal
          :fail-info "Test 4")
    
    (test (list "def")
          (does-not-contain '("abc" "def" "ghi") '("ab" "gh"))
          :test #'equal
          :fail-info "Test 5")
    
    (test "123 + 345 + 567"
          (fluff-string "123+345+567" "+" :fluff-char #\Space )
          :test #'equal
          :fail-info "Test 6")
    )
  t
  )