1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
6 ;;;; Purpose: Regression suite for UMLisp
7 ;;;; Author: Kevin M. Rosenberg
8 ;;;; Date Started: May 2003
10 ;;;; $Id: tests.lisp,v 1.3 2003/05/03 17:10:08 kevin Exp $
12 ;;;; This file, part of UMLisp, is
13 ;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
15 ;;;; UMLisp users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the GNU General Public License.
17 ;;;; *************************************************************************
19 (defpackage #:umlisp-tests
20 (:use #:umlisp #:cl #:rtest))
21 (in-package #:umlisp-tests)
23 (setf rtest::*catch-errors* nil)
27 (deftest qs.1 (umlisp::query-string 'mrcon '(cui lui))
28 "select CUI,LUI from MRCON")
30 (deftest qs.2 (umlisp::query-string 'mrcon '(cui lui) 0)
31 "select CUI,LUI from MRCON and KCUILRL <= 0")
33 (deftest qs.3 (umlisp::query-string 'mrcon '(cui lui) nil 'cui 5)
34 "select CUI,LUI from MRCON where CUI=5")
36 (deftest qs.4 (umlisp::query-string 'mrcon '(cui lui) nil 'kpfstr "Abc")
37 "select CUI,LUI from MRCON where KPFSTR='Abc'")
39 (deftest qs.5 (umlisp::query-string 'mrcon '(cui lui) 2 'cui 5 :single t)
40 "select CUI,LUI from MRCON where CUI=5 and KCUILRL <= 2 limit 1")
42 (deftest qs.6 (umlisp::query-string 'mrdef '(sab def) 2 'cui 39 :lrlname 'ksrl :single t)
43 "select SAB,DEF from MRDEF where CUI=39 and KSRL <= 2 limit 1")
45 (deftest qs.7 (umlisp::query-string 'mrdef '(sab def) 2 'cui 39 :lrlname 'ksrl :order '((cui . asc)))
46 "select SAB,DEF from MRDEF where CUI=39 and KSRL <= 2 order by CUI asc")
48 (deftest qs.8 (umlisp::query-string 'mrdef '(sab def) 2 'cui 39 :lrlname 'ksrl
49 :order '((cui . asc) (def . desc)))
50 "select SAB,DEF from MRDEF where CUI=39 and KSRL <= 2 order by CUI asc,DEF desc")
55 (defun f2 (&key (srl *current-srl*))
56 "Return list of all ucon's"
57 (umlisp::with-umlisp-query ('mrcon (cui kpfstr kcuilrl) srl nil nil)
58 (make-instance 'ucon :cui (ensure-integer cui) :pfstr kpfstr
59 :lrl (ensure-integer kcuilrl))))
61 (defun f1 (&key (srl *current-srl*))
62 "Return list of all ucon's"
63 (umlisp::with-sql-connection (db)
66 #'(lambda (cui pfstr cuilrl)
67 (make-instance 'ucon :cui (ensure-integer cui)
69 :lrl (ensure-integer cuilrl)))
70 (query-string 'mrcon '(cui kpfstr kcuilrl) srl nil nil)