Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Added tests for some utilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpapp committed Apr 19, 2013
1 parent 03d1acb commit 3b08224
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cl-num-utils.asd
Expand Up @@ -52,4 +52,5 @@
(:file "matrix")
(:file "matrix-shorthand")
(:file "num=")
(:file "statistics")))
(:file "statistics")
(:file "utilities")))
25 changes: 25 additions & 0 deletions tests/utilities.lisp
@@ -0,0 +1,25 @@
;;; -*- Mode:Lisp; Syntax:ANSI-Common-Lisp; Coding:utf-8 -*-

(in-package #:cl-num-utils-tests)

(defsuite utilities-tests (tests))

(deftest gethash-test (utilities-tests)
(let ((table (make-hash-table :test #'eq)))
(setf (gethash 'a table) 1)
(assert-eql 1 (gethash* 'a table))
(assert-condition error (gethash* 'b table))))

(deftest biconditional-test (utilities-tests)
(assert-true (bic t t))
(assert-true (bic nil nil))
(assert-false (bic t nil))
(assert-false (bic nil t)))

(deftest splice-when (utilities-tests)
(assert-equal '(a b c) `(a ,@(splice-when t 'b) c))
(assert-equal '(a c) `(a ,@(splice-when nil 'b) c))
(assert-equal '(a b c) `(a ,@(splice-awhen 'b it) c))
(assert-equal '(a c) `(a ,@(splice-awhen (not 'b) it) c)))

;;; FIXME: write tests for other utilities

0 comments on commit 3b08224

Please sign in to comment.