diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-12 04:01:10 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-12 04:01:10 +0300 |
commit | e50173c65dca2cd0e0b5cbc563b7fa36b4d164ca (patch) | |
tree | c51ac0da8d875fed9156cc67bc9b1a931650299b | |
parent | a9fa703eecfc81b26c1d969cc13a7ce476c84d6d (diff) | |
download | ellinika-e50173c65dca2cd0e0b5cbc563b7fa36b4d164ca.tar.gz ellinika-e50173c65dca2cd0e0b5cbc563b7fa36b4d164ca.tar.bz2 |
Add tests.
45 files changed, 315 insertions, 0 deletions
diff --git a/src/ellinika/test-conjugation.scm b/src/ellinika/test-conjugation.scm new file mode 100644 index 0000000..83086bf --- /dev/null +++ b/src/ellinika/test-conjugation.scm | |||
@@ -0,0 +1,78 @@ | |||
1 | ;;;; This file is part of Ellinika project. | ||
2 | ;;;; Copyright (C) 2011 Sergey Poznyakoff | ||
3 | ;;;; | ||
4 | ;;;; Ellinika is free software; you can redistribute it and/or modify | ||
5 | ;;;; it under the terms of the GNU General Public License as published by | ||
6 | ;;;; the Free Software Foundation; either version 3 of the License, or | ||
7 | ;;;; (at your option) any later version. | ||
8 | ;;;; | ||
9 | ;;;; Ellinika is distributed in the hope that it will be useful, | ||
10 | ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | ;;;; GNU General Public License for more details. | ||
13 | ;;;; | ||
14 | ;;;; You should have received a copy of the GNU General Public License | ||
15 | ;;;; along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | (define-module (ellinika test-conjugation)) | ||
18 | |||
19 | (use-modules (srfi srfi-1) | ||
20 | (ellinika elmorph) | ||
21 | (ellinika i18n) | ||
22 | (ellinika cgi) | ||
23 | (ellinika tenses) | ||
24 | (ellinika conjugator) | ||
25 | (gamma sql)) | ||
26 | |||
27 | (ellinika-cgi-init dict-template-file-name) | ||
28 | (define db-connection (sql-open-connection ellinika-sql-connection)) | ||
29 | (sql-query db-connection "SET NAMES utf8") | ||
30 | |||
31 | |||
32 | (define transtab | ||
33 | '(("act" . "Ενεργητηκή φωνή") | ||
34 | ("pas" . "Μεσοπαθητική φωνή") | ||
35 | ("ind" . "Οριστική") | ||
36 | ("sub" . "Υποτακτική") | ||
37 | ("imp" . "Προστακτική"))) | ||
38 | |||
39 | (define (term x) | ||
40 | (or (assoc-ref transtab x) x)) | ||
41 | |||
42 | (define-public (test-conjugation:tense verb voice mood tense) | ||
43 | (for-each | ||
44 | (lambda (result) | ||
45 | (format #t "~A ~A/~A/~A: " verb (term voice) (term mood) tense) | ||
46 | (let ((conj (conjugation:table result))) | ||
47 | (cond | ||
48 | ((empty-conjugation? conj) | ||
49 | (display "#f")) | ||
50 | (else | ||
51 | (let ((att (conjugation:attested result))) | ||
52 | (cond | ||
53 | ((not att) | ||
54 | (display "*")) | ||
55 | (else | ||
56 | (if (not (member 'class att)) | ||
57 | (display "*")) | ||
58 | (if (not (member 'root att)) | ||
59 | (display "!")))) | ||
60 | (display conj))))) | ||
61 | (newline)) | ||
62 | (conjugator db-connection verb voice mood tense)) | ||
63 | (gc)) | ||
64 | |||
65 | (define-public (test-conjugation:voice voice verb) | ||
66 | (for-each | ||
67 | (lambda (mood-tenses) | ||
68 | (let ((mood (car mood-tenses))) | ||
69 | (for-each | ||
70 | (lambda (tense) | ||
71 | (test-conjugation:tense verb voice mood tense)) | ||
72 | (cdr mood-tenses)))) | ||
73 | ellinika-tense-list)) | ||
74 | |||
75 | (define-public (test-conjugation:verb verb) | ||
76 | (test-conjugation:voice "act" verb) | ||
77 | (test-conjugation:voice "pas" verb)) | ||
78 | |||
diff --git a/src/ellinika/tests/accsyl.scm b/src/ellinika/tests/accsyl.scm new file mode 100644 index 0000000..af91eb4 --- /dev/null +++ b/src/ellinika/tests/accsyl.scm | |||
@@ -0,0 +1,7 @@ | |||
1 | (load-extension "./libelmorph" "scm_init_ellinika_elmorph_module") | ||
2 | |||
3 | (let ((str "έρχομαι")) | ||
4 | (display (elstr-accented-syllable str)) | ||
5 | (newline)) | ||
6 | |||
7 | \ No newline at end of file | ||
diff --git a/src/ellinika/tests/aorist.scm b/src/ellinika/tests/aorist.scm new file mode 100644 index 0000000..5c47162 --- /dev/null +++ b/src/ellinika/tests/aorist.scm | |||
@@ -0,0 +1,22 @@ | |||
1 | (load-extension "./libelmorph" "scm_init_ellinika_elmorph_module") | ||
2 | |||
3 | (for-each | ||
4 | (lambda (root) | ||
5 | (display (elstr-thema-aoristoy root)) | ||
6 | (newline)) | ||
7 | (list | ||
8 | "χαν" | ||
9 | "νιωθ" | ||
10 | "διαβαζ" | ||
11 | "πλεκ" | ||
12 | "ανοιγ" | ||
13 | "προσεχ" | ||
14 | "διδασκ" | ||
15 | "φτιαχν" | ||
16 | "αλλαζ" | ||
17 | "λειπ" | ||
18 | "σκαβ" | ||
19 | "βάφ" | ||
20 | "δουλεύ" | ||
21 | "παύ" | ||
22 | "ζη")) | ||
diff --git a/src/ellinika/tests/append-el.scm b/src/ellinika/tests/append-el.scm new file mode 100644 index 0000000..206e465 --- /dev/null +++ b/src/ellinika/tests/append-el.scm | |||
@@ -0,0 +1,7 @@ | |||
1 | (load-extension "./libelmorph" "scm_init_ellinika_elmorph_module") | ||
2 | |||
3 | (display | ||
4 | (elstr-append (string->elstr "παρακ") | ||
5 | "εί" | ||
6 | "μενος")) | ||
7 | (newline) | ||
diff --git a/src/ellinika/tests/append-s.scm b/src/ellinika/tests/append-s.scm new file mode 100644 index 0000000..92e7149 --- /dev/null +++ b/src/ellinika/tests/append-s.scm | |||
@@ -0,0 +1,7 @@ | |||
1 | (load-extension "./libelmorph" "scm_init_ellinika_elmorph_module") | ||
2 | |||
3 | (display | ||
4 | (elstr-append "παρακ" | ||
5 | "εί" | ||
6 | "μενος")) | ||
7 | (newline) | ||
diff --git a/src/ellinika/tests/conj/aggelv.scm b/src/ellinika/tests/conj/aggelv.scm new file mode 100644 index 0000000..e9f584f --- /dev/null +++ b/src/ellinika/tests/conj/aggelv.scm | |||
@@ -0,0 +1,3 @@ | |||
1 | (use-modules ((ellinika test-conjugation))) | ||
2 | |||
3 | (test-conjugation:verb "αγγέλω") | ||
diff --git a/src/ellinika/tests/conj/agv.scm b/src/ellinika/tests/conj/agv.scm new file mode 100644 index 0000000..4bbc05d --- /dev/null +++ b/src/ellinika/tests/conj/agv.scm | |||
@@ -0,0 +1,3 @@ | |||
1 | (use-modules ((ellinika test-conjugation))) | ||
2 | |||
3 | (test-conjugation:verb "άγω") | ||
diff --git a/src/ellinika/tests/conj/anebainv.scm b/src/ellinika/tests/conj/anebainv.scm new file mode 100644 index 0000000..2c96cef --- /dev/null +++ b/src/ellinika/tests/conj/anebainv.scm | |||
@@ -0,0 +1,3 @@ | |||
1 | (use-modules ((ellinika test-conjugation))) | ||
2 | |||
3 | (test-conjugation:verb "ανεβαίνω") | ||
diff --git a/src/ellinika/tests/conj/anoigv.scm b/src/ellinika/tests/conj/anoigv.scm new file mode 100644 index 0000000..4ba6e12 --- /dev/null +++ b/src/ellinika/tests/conj/anoigv.scm | |||
@@ -0,0 +1,3 @@ | |||
1 | (use-modules ((ellinika test-conjugation))) | ||
2 | |||
3 | (test-conjugation:verb "ανοίγω") | ||
diff --git a/src/ellinika/tests/conj/aresv.scm b/src/ellinika/tests/conj/aresv.scm new file mode 100644 index 0000000..d4e54f9 --- /dev/null +++ b/src/ellinika/tests/conj/aresv.scm | |||
@@ -0,0 +1,3 @@ | |||
1 | (use-modules ((ellinika test-conjugation))) | ||
2 |