From f761dc1d39bb92917db53f935348f79e4db95e40 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Wed, 7 May 2003 23:06:44 +0000 Subject: [PATCH] r4873: *** empty log message *** --- tests/basic.lisp | 103 +++++++++++++++++++++++++++++++++++++++++++++ tests/package.lisp | 23 ++++++++++ tests/parse.lisp | 19 +++++++++ 3 files changed, 145 insertions(+) create mode 100644 tests/basic.lisp create mode 100644 tests/package.lisp create mode 100644 tests/parse.lisp diff --git a/tests/basic.lisp b/tests/basic.lisp new file mode 100644 index 0000000..a86d8a5 --- /dev/null +++ b/tests/basic.lisp @@ -0,0 +1,103 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: basic.lisp +;;;; Purpose: Basic tests for UMLisp +;;;; Author: Kevin M. Rosenberg +;;;; Date Started: May 2003 +;;;; +;;;; $Id: basic.lisp,v 1.1 2003/05/07 23:06:44 kevin Exp $ +;;;; +;;;; This file, part of UMLisp, is +;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. +;;;; +;;;; UMLisp users are granted the rights to distribute and use this software +;;;; as governed by the terms of the GNU General Public License. +;;;; ************************************************************************* + +(in-package #:umlisp-tests) + +(deftest qs.1 (umlisp::query-string mrcon (cui lui)) + "select CUI,LUI from MRCON") + +(deftest qs.1e (umlisp::query-string-eval 'mrcon '(cui lui)) + "select CUI,LUI from MRCON") + +(deftest qs.2 (umlisp::query-string mrcon (cui lui) 0) + "select CUI,LUI from MRCON and KCUILRL<=0") + +(deftest qs.2e (umlisp::query-string-eval 'mrcon '(cui lui) 0) + "select CUI,LUI from MRCON and KCUILRL<=0") + +(deftest qs.3 (umlisp::query-string mrcon (cui lui) nil cui 5) + "select CUI,LUI from MRCON where CUI=5") + +(deftest qs.3e (umlisp::query-string-eval 'mrcon '(cui lui) nil 'cui 5) + "select CUI,LUI from MRCON where CUI=5") + +(deftest qs.4 (umlisp::query-string mrcon (cui lui) nil kpfstr "Abc") + "select CUI,LUI from MRCON where KPFSTR='Abc'") + +(deftest qs.4e (umlisp::query-string-eval 'mrcon '(cui lui) nil 'kpfstr "Abc") + "select CUI,LUI from MRCON where KPFSTR='Abc'") + +(deftest qs.5 (umlisp::query-string mrcon (cui lui) 2 cui 5 :single t) + "select CUI,LUI from MRCON where CUI=5 and KCUILRL<=2 limit 1") + +(deftest qs.5e (umlisp::query-string-eval 'mrcon '(cui lui) 2 'cui 5 :single t) + "select CUI,LUI from MRCON where CUI=5 and KCUILRL<=2 limit 1") + +(deftest qs.6 (umlisp::query-string mrdef (sab def) 2 cui 39 :lrl ksrl :single t) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 limit 1") + +(deftest qs.6e (umlisp::query-string-eval 'mrdef '(sab def) 2 'cui 39 :lrl 'ksrl :single t) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 limit 1") + +(deftest qs.7 (umlisp::query-string mrdef (sab def) 2 cui 39 :lrl ksrl :order (cui asc)) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 order by CUI asc") + +(deftest qs.7e (umlisp::query-string-eval 'mrdef '(sab def) 2 'cui 39 :lrl 'ksrl :order '(cui asc)) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 order by CUI asc") + +(deftest qs.8 (umlisp::query-string mrdef (sab def) 2 cui 39 :lrl ksrl + :order (cui asc def desc)) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 order by CUI asc,DEF desc") + +(deftest qs.8e (umlisp::query-string-eval 'mrdef '(sab def) 2 'cui 39 :lrl 'ksrl + :order '(cui asc def desc)) + "select SAB,DEF from MRDEF where CUI=39 and KSRL<=2 order by CUI asc,DEF desc") + +(deftest ui.1 (umlisp::parse-cui "C0002341") 2341) +(deftest ui.2 (umlisp::parse-lui "L0002341") 2341) +(deftest ui.3 (umlisp::parse-sui "S0000000") 0) +(deftest ui.4 (umlisp::parse-tui "T123") 123) +(deftest ui.5 (fmt-cui 2341) "C0002341") +(deftest ui.6 (fmt-lui 2341) "L0002341") +(deftest ui.7 (fmt-sui 2341) "S0002341") +(deftest ui.8 (fmt-tui 231) "T231") +(deftest ui.9 (fmt-tui 231) "T231") +(deftest ui.10 (fmt-eui 231) "E0000231") +(deftest ui.11 (umlisp::make-cuisui 5 11) 50000011) +(deftest ui.12 (umlisp::decompose-cuisui 50000011) 5 11) +(deftest ui.13 (umlisp::parse-eui "E00002311") 2311) +(deftest ui.14 (umlisp::parse-lui "1234") 1234) +(deftest ui.15 (umlisp::parse-lui 1234) 1234) + +(defun f2 (&key (srl *current-srl*)) + "Return list of all ucon's" + (umlisp::with-umlisp-query ('mrcon (cui kpfstr kcuilrl) srl nil nil) + (make-instance 'ucon :cui (ensure-integer cui) :pfstr kpfstr + :lrl (ensure-integer kcuilrl)))) + +(defun f1 (&key (srl *current-srl*)) + "Return list of all ucon's" + (umlisp::with-sql-connection (db) + (clsql:map-query + 'list + #'(lambda (cui pfstr cuilrl) + (make-instance 'ucon :cui (ensure-integer cui) + :pfstr pfstr + :lrl (ensure-integer cuilrl))) + (umlisp::query-string 'mrcon '(cui kpfstr kcuilrl) srl nil nil) + :database db))) diff --git a/tests/package.lisp b/tests/package.lisp new file mode 100644 index 0000000..166266c --- /dev/null +++ b/tests/package.lisp @@ -0,0 +1,23 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: package.lisp +;;;; Purpose: Package definition for UMLisp Regression suite +;;;; Author: Kevin M. Rosenberg +;;;; Date Started: May 2003 +;;;; +;;;; $Id: package.lisp,v 1.1 2003/05/07 23:06:44 kevin Exp $ +;;;; +;;;; This file, part of UMLisp, is +;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. +;;;; +;;;; UMLisp users are granted the rights to distribute and use this software +;;;; as governed by the terms of the GNU General Public License. +;;;; ************************************************************************* + +(defpackage #:umlisp-tests + (:use #:umlisp #:cl #:rtest #:kmrcl)) + +(setf rtest::*catch-errors* nil) + diff --git a/tests/parse.lisp b/tests/parse.lisp new file mode 100644 index 0000000..e1dcd30 --- /dev/null +++ b/tests/parse.lisp @@ -0,0 +1,19 @@ +;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: parse.lisp +;;;; Purpose: Parsing tests for UMLisp +;;;; Author: Kevin M. Rosenberg +;;;; Date Started: May 2003 +;;;; +;;;; $Id: parse.lisp,v 1.1 2003/05/07 23:06:44 kevin Exp $ +;;;; +;;;; This file, part of UMLisp, is +;;;; Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D. +;;;; +;;;; UMLisp users are granted the rights to distribute and use this software +;;;; as governed by the terms of the GNU General Public License. +;;;; ************************************************************************* + +(in-package #:umlisp-tests) -- 2.34.1