File: parse.lisp

package info (click to toggle)
cl-umlisp 1%3A2007ac.2-6.1
  • links: PTS, VCS
  • area: contrib
  • in suites: bookworm, sid
  • size: 296 kB
  • sloc: lisp: 3,593; makefile: 57
file content (79 lines) | stat: -rw-r--r-- 2,503 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
;;;; -*- 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$
;;;;
;;;; 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)

(eval-when (:compile-toplevel :load-toplevel :execute)
  (import '(umlisp::*umls-files* umlisp::*umls-cols*)))

(setq *rt-parse*
  '(
    (deftest :parse/1
        (umlisp::decompose-fil "abc")
      "abc" nil)

    (deftest :parse/2
        (umlisp::decompose-fil "dir/abc")
      "abc" "dir")

    (deftest :parse/3
        (umlisp::decompose-fil nil)
      nil nil)

    (deftest :parse/4
        (umlisp::filename-to-tablename "test")
      "test")

    (deftest :parse/5
        (umlisp::filename-to-tablename "TEST.AB.RRF")
      "TEST_AB")))

;; specific for UMLS2007AA
(when (probe-file (umlisp::umls-pathname "MRFILES.RRF"))
  (umlisp::ensure-ucols+ufiles)
  (setq
   *rt-parse*
   (append
    *rt-parse*
    '(
      (deftest uparse.1 (length *umls-files*) 63)
      (deftest uparse.2 (length *umls-cols*) 452)
      (deftest uparse.3
          (sort (mapcar #'u::col (umlisp::ucols (umlisp::find-ufile "MRCONSO.RRF")))
           #'string<)
        ("AUI" "CODE" "CUI" "CVF" "ISPREF" "KCUILRL" "KCUILUI" "KCUISUI" "KLUILRL"
         "KPFENG" "KSUILRL" "LAT" "LUI" "SAB" "SAUI" "SCUI" "SDUI" "SRL" "STR" "STT"
         "SUI" "SUPPRESS" "TS" "TTY"))
      (deftest uparse.4
          (equal
           (sort (mapcar #'u::col (umlisp::ucols (umlisp::find-ufile "MRCONSO.RRF")))
                 #'string<)
           (sort (copy-seq (umlisp::fields (umlisp::find-ufile "MRCONSO.RRF")))
                 #'string<))
        t)
      (deftest uparse.5
          (sort
           (umlisp::custom-colnames-for-filename "MRCONSO.RRF")
           #'string<)
        ("KCUILRL" "KCUILUI" "KCUISUI" "KLUILRL" "KPFENG" "KSUILRL"))
      (deftest uparse.6
          (compiled-function-p
           (umlisp::custom-value-fun
            (umlisp::find-ucol "KCUISUI" "MRCONSO.RRF")))
        t)
      ))))