r11469: update test suite
[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*) 63)
54       (deftest uparse.2 (length *umls-cols*) 434)
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"
59          "KPFENG" "KSUILRL" "LAT" "LUI" "SAB" "SAUI" "SCUI" "SDUI" "SRL" "STR" "STT"
60          "SUI" "SUPPRESS" "TS" "TTY"))
61       (deftest uparse.4
62           (equal
63            (sort (mapcar #'u::col (umlisp::ucols (umlisp::find-ufile "MRCONSO.RRF")))
64                  #'string<)
65            (sort (copy-seq (umlisp::fields (umlisp::find-ufile "MRCONSO.RRF")))
66                  #'string<))
67         t)
68       (deftest uparse.5
69           (sort
70            (umlisp::custom-colnames-for-filename "MRCONSO.RRF")
71            #'string<)
72         ("KCUILRL" "KCUILUI" "KCUISUI" "KLUILRL" "KPFENG" "KSUILRL"))
73       (deftest uparse.6
74           (compiled-function-p
75            (umlisp::custom-value-fun
76             (umlisp::find-ucol "KCUISUI" "MRCONSO.RRF")))
77         t)
78       ))))