Changeset 22268 in project


Ignore:
Timestamp:
01/06/11 17:54:54 (11 years ago)
Author:
Alan Post
Message:

jbogenturfa'i: load and test all rafsi.

Location:
release/4/jbogenturfahi/trunk
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • release/4/jbogenturfahi/trunk/chicken-db.scm

    r22226 r22268  
    1717(include "wordlists/cmavo.scm")
    1818(include "wordlists/gismu.scm")
     19(include "wordlists/rafsi.scm")
  • release/4/jbogenturfahi/trunk/chicken-ext.scm

    r22226 r22268  
    3737   gismu:gen-select-list
    3838   
     39   rafsi:drop-table
     40   rafsi:create-table
     41   rafsi:gen-insert
     42   rafsi:gen-select-list
     43   
    3944   jbogenturfahi-db
    4045   jbogenturfahi-db-file)
  • release/4/jbogenturfahi/trunk/db.scm

    r22226 r22268  
    3232))
    3333
     34(define (rafsi:drop-table)
     35  (sql:drop-table jbogenturfahi-db #<<EOS
     36drop table if exists rafsi;
     37EOS
     38))
     39
     40
    3441(define (cmavo:create-table)
    3542  (sql:create-table jbogenturfahi-db #<<EOS
     
    4855))
    4956
     57(define (rafsi:create-table)
     58  (sql:create-table jbogenturfahi-db #<<EOS
     59create table if not exists
     60rafsi(rafsi varchar(4) primary key,
     61      valsi varchar(5) not null);
     62EOS
     63))
     64
     65
    5066(define (cmavo:gen-insert)
    5167  (sql:gen-insert jbogenturfahi-db #<<EOS
     
    6177EOS
    6278))
     79
     80(define (rafsi:gen-insert)
     81  (sql:gen-insert jbogenturfahi-db #<<EOS
     82insert into rafsi('rafsi', 'valsi')
     83values(?, ?);
     84EOS
     85))
     86
    6387
    6488(define (cmavo:gen-select-list)
     
    78102EOS
    79103))
     104
     105(define (rafsi:gen-select-list)
     106  (sql:gen-select-list jbogenturfahi-db #<<EOS
     107select   rafsi,
     108         valsi
     109from     rafsi
     110order by rafsi
     111EOS
     112))
  • release/4/jbogenturfahi/trunk/tests/rafsi.scm

    r22267 r22268  
    1818;;;;
    1919
    20 (module jbogenturfahi
    21   (jbogenturfahi-version
    22    jbogenturfahi-version-major
    23    jbogenturfahi-version-minor
    24    jbogenturfahi-version-patch
     20(define (test-rafsi rafsi valsi)
     21  (define (t pamoi remoi)
     22     (test #t (string=? pamoi remoi)))
    2523
    26    jbogenturfahi-rafske
    27    jbogenturfahi
     24         ; parse this rafsi+valsi
     25         ;
     26  (let* ((genrafsi(jbogenturfahi-rafske rafsi))
     27         (genvla  (jbogenturfahi-rafske valsi)))
    2828
    29    cmavo:drop-table
    30    cmavo:create-table
    31    cmavo:gen-insert
    32    cmavo:gen-select-list
    33    
    34    gismu:drop-table
    35    gismu:create-table
    36    gismu:gen-insert
    37    gismu:gen-select-list
    38    
    39    jbogenturfahi-db
    40    jbogenturfahi-db-file)
     29    (test '() (cdr genrafsi))
     30    (test '() (cdr genvla))
    4131
    42 (import chicken)
    43 (import scheme)
     32    (match (car genrafsi)
     33      (('cmavo (_ cmavo))       (t rafsi cmavo))
     34      (('cmavo cmavo)           (t rafsi cmavo))
     35      (('cmene cmene)           (t rafsi cmene))
     36      (('non-lojban-word jalge) (t rafsi jalge)))
    4437
    45 (require-extension srfi-14)
    46 (require-extension extras)
     38    (match (car genvla)
     39      (('gismu gismu)     (t valsi gismu))
     40      (('cmavo (_ cmavo)) (t valsi cmavo))
     41      (('cmene cmene)     (t valsi cmene)))))
    4742
    48 (require-library genturfahi)
    49 (require-library jbogerna)
     43(define (rafsi)
     44  (let ((rodarafsi (rafsi:gen-select-list)))
     45    (map-apply test-rafsi (rodarafsi)))
     46  0)
    5047
    51 (require-library sqlite3)
    52 
    53 
    54 (import srfi-14)
    55 (import extras)
    56 
    57 (import genturfahi)
    58 (import jbogerna)
    59 
    60 (import sqlite3)
    61 
    62 (include "jbogenturfahi.scm")
    63 (include "version.scm")
    64 (include "path.scm")
    65 (include "c0re.scm")
    66 (include "sql.scm")
    67 (include "db.scm"))
     48(test-group "rafsi"
     49  (rafsi))
  • release/4/jbogenturfahi/trunk/tests/run.scm

    r22226 r22268  
    2323(include "cmavo.scm")
    2424(include "gismu.scm")
     25(include "rafsi.scm")
    2526
    2627(test-exit)
  • release/4/jbogenturfahi/trunk/wordlists/rafsi.scm

    r22267 r22268  
    1818;;;;
    1919
    20 (module jbogenturfahi
    21   (jbogenturfahi-version
    22    jbogenturfahi-version-major
    23    jbogenturfahi-version-minor
    24    jbogenturfahi-version-patch
     20(set! gerna #<<EOS
     21{(no-memoize "CRLF")}
    2522
    26    jbogenturfahi-rafske
    27    jbogenturfahi
     23cfari       <- `((!CRLF .)* CRLF) lerpinsle* `FAhO
    2824
    29    cmavo:drop-table
    30    cmavo:create-table
    31    cmavo:gen-insert
    32    cmavo:gen-select-list
    33    
    34    gismu:drop-table
    35    gismu:create-table
    36    gismu:gen-insert
    37    gismu:gen-select-list
    38    
    39    jbogenturfahi-db
    40    jbogenturfahi-db-file)
     25lerpinsle   <- rafsi gismu gloss `CRLF?
     26            -> {(lambda (rafsi gismu gloss) `(,rafsi ,gismu))}
    4127
    42 (import chicken)
    43 (import scheme)
     28rafsi       <- [[:jbole'u:]]+
     29               canlu
     30gismu       <- [[:jbole'u:]*]+
     31               canlu
     32gloss       <- (!(CRLF / &FAhO) .)+
    4433
    45 (require-extension srfi-14)
    46 (require-extension extras)
     34canlu       <- `canlu-lerfu*
     35canlu-lerfu <- [[:space:]]
    4736
    48 (require-library genturfahi)
    49 (require-library jbogerna)
     37CR          <- #\return
     38LF          <- #\linefeed
     39CRLF        <- CR LF / CR / LF
    5040
    51 (require-library sqlite3)
     41FAhO        <- !.
     42EOS
     43)
    5244
     45(let* ((samselpla (genturfahi-peg gerna))
     46       (gerna     (genturfahi (eval samselpla)))
     47       (rafsi     (call-with-input-file "wordlists/rafsi.txt" gerna)))
    5348
    54 (import srfi-14)
    55 (import extras)
     49  (rafsi:drop-table)
     50  (rafsi:create-table)
    5651
    57 (import genturfahi)
    58 (import jbogerna)
    59 
    60 (import sqlite3)
    61 
    62 (include "jbogenturfahi.scm")
    63 (include "version.scm")
    64 (include "path.scm")
    65 (include "c0re.scm")
    66 (include "sql.scm")
    67 (include "db.scm"))
     52  (call-with-values
     53    rafsi:gen-insert
     54    (lambda (insert cleanup)
     55      (map-apply insert rafsi)
     56      (cleanup))))
Note: See TracChangeset for help on using the changeset viewer.