;;; -*-lisp-*- ;;; ;;; Package definition and other basic stuff for SOD tests ;;; ;;; (c) 2009 Straylight/Edgeware ;;; ;;;----- Licensing notice --------------------------------------------------- ;;; ;;; This file is part of the Sensible Object Design, an object system for C. ;;; ;;; SOD is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; (at your option) any later version. ;;; ;;; SOD is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with SOD; if not, write to the Free Software Foundation, ;;; Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. (cl:defpackage #:sod-test (:use #:common-lisp #+sbcl #:sb-mop #+(or cmu clisp) #:mop #+ecl #:mop #:xlunit #:sod-utilities #:sod-parser #:sod) ;; Some internal symbols which are useful. This is somewhat bletcherous. (:import-from #:sod-parser #:charbuf-size)) (cl:in-package #:sod-test) (defvar *sod-test-suite* (make-instance 'test-suite :name "Sod master test suite" :description "Top-level test for the Sod translator.")) (defun assert-princ (object string) (let* ((*print-right-margin* 77) (*print-pretty* t) (print (princ-to-string object))) (assert-equal print string (format nil "Assert princ: ~S ~_prints as `~A' ~_~ rather than `~A'." object print string)))) (defclass base-test (test-case) ()) (add-test *sod-test-suite* (get-suite base-test)) (defun run-tests (&optional which) (textui-test-run (acond ((null which) *sod-test-suite*) ((labels ((dredge (suite) (cond ((typep suite 'test-suite) (some #'dredge (tests suite))) ((eq (xlunit::name suite) which) suite) (t nil)))) (dredge *sod-test-suite*)) it) ((find-class which nil) (suite (make-instance it))) (t (error "Don't know how to turn ~S into a test suite" which))))) ;;;----- That's all, folks --------------------------------------------------