c7a42e021b3c05c7c2341beebe73eea35d3afbc6
[umlisp.git] / tests / parse.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; Package: umlisp -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          parse.lisp
6 ;;;; Purpose:       Parsing tests for UMLisp
7 ;;;; Author:        Kevin M. Rosenberg
8 ;;;; Date Started:  May 2003
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of UMLisp, is
13 ;;;;    Copyright (c) 2000-2002 by Kevin M. Rosenberg, M.D.
14 ;;;;
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 ;;;; *************************************************************************
18
19 (in-package #:umlisp-tests)
20
21 (eval-when (:compile-toplevel :load-toplevel :execute)
22   (import '(umlisp::*umls-files* umlisp::*umls-cols*)))
23
24 (setq *rt-parse*
25   '(
26     (deftest :parse/1
27         (umlisp::decompose-fil "abc")
28       "abc" nil)
29     
30     (deftest :parse/2
31         (umlisp::decompose-fil "dir/abc")
32       "abc" "dir")
33     
34     (deftest :parse/3
35         (umlisp::decompose-fil nil)
36       nil nil)
37     
38     (deftest :parse/4
39         (umlisp::filename-to-tablename "test")
40       "test")
41     
42     (deftest :parse/5
43         (umlisp::filename-to-tablename "TEST.AB.RRF")
44       "TEST_AB")))
45
46 (when (probe-file (umlisp::umls-pathname "MRFILES.RRF"))
47   (umlisp::ensure-ucols+ufiles)
48   (setq
49    *rt-parse*
50    (append
51     *rt-parse*
52     '(
53       (deftest uparse.1 (length *umls-files*) 64)
54       (deftest uparse.2 (length *umls-cols*) 327)
55       (deftest uparse.3
56           (sort (mapcar #'u::col (umlisp::ucols (umlisp::find-ufile "MRCONSO.RRF")))
57            #'string<)
58         ("AUI" "CODE" "CUI" "CVF" "ISPREF" "KCUILRL" "KCUILUI" "KCUISUI" "KLUILRL" "KPFSTR" "LAT" "LUI" "SAB" "SAUI" "SCUI" "SDUI" "SRL" "STR"
59          "STT" "SUI" "SUPPRESS" "TS" "TTY"))
60       (deftest uparse.4
61           (equal
62            (sort (mapcar #'u::col (umlisp::ucols (umlisp::find-ufile "MRCONSO.RRF")))
63                  #'string<)
64            (sort (umlisp::fields (umlisp::find-ufile "MRCONSO.RRF"))
65                  #'string<))
66         t)
67       (deftest uparse.5
68           (sort
69            (umlisp::custom-colnames-for-filename "MRCONSO.RRF")
70            #'string<)
71         ("KCUILRL" "KCUILUI" "KCUISUI" "KLUILRL" "KPFSTR"))
72       (deftest uparse.6
73           (compiled-function-p
74            (umlisp::custom-value-fun
75             (umlisp::find-ucol "KCUISUI" "MRCONSO.RRF")))
76         t)
77       ))))