;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; ClassicJava: an implementation of the ClassicJava programming language ;; test.ss: SchemeUnit assertions and other helper functions for testing. ;; Copyright (C) 2005 Richard Cobbe ;; ;; This library is free software; you can redistribute it and/or modify it ;; under the terms of the GNU Lesser General Public License as published by ;; the Free Software Foundation; either version 2.1 of the License, or (at ;; your option) any later version. ;; ;; This library 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 Lesser General Public ;; License for more details. ;; ;; You should have received a copy of the GNU Lesser General Public License ;; along with this library; if not, write to the Free Software Foundation, ;; Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (module test mzscheme (require (planet "test.ss" ("schematics" "schemeunit.plt" 1 1))) ;; need test.ss for assert-true. ;; An assertion for expressions that handle multiple values. ;; same? : predicate for comparing expected with actual results ;; expr : expression to test ;; exp1 exps ... : expected results (define-syntax mv-assert (syntax-rules () [(_ same? expr exp1 exps ...) (call-with-values (lambda () expr) (lambda actual (assert-true (andmap same? actual (list exp1 exps ...)))))])) (define hash-table->sexpr (lambda (ht) (hash-table-map ht list))) (provide mv-assert hash-table->sexpr))