Changeset 36959 in project


Ignore:
Timestamp:
12/03/18 03:53:57 (10 days ago)
Author:
kon
Message:

activate tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/5/bloom-filter/trunk/tests/bloom-filter-test.scm

    r36232 r36959  
    137137(define mdps (append mdps-basic mdps-xtra))
    138138
     139(define palindromic-word-list '(
     140  "bob"
     141  "elle"
     142  "evil"
     143  "flow"
     144  "harrah"
     145  "hexeh"
     146  "js"
     147  "live"
     148  "map"
     149  "non"
     150  "pam"
     151  "pop"
     152  "radar"
     153  "sj"
     154  "wolf"))
     155#; ;Compute above from word file
    139156(define palindromic-word-list
    140   '("bob"
    141     "elle"
    142     "evil"
    143     "flow"
    144     "harrah"
    145     "hexeh"
    146     "js"
    147     "live"
    148     "map"
    149     "non"
    150     "pam"
    151     "pop"
    152     "radar"
    153     "sj"
    154     "wolf")
    155   #; ;Compute above from word file
    156   (let* ((word-list (read-file "bloom-filter-word-list.txt"))
    157          (word-tbl (alist->hash-table (map (cut cons <> #t) word-list)))
    158          (other-word-list (map string-reverse word-list)) )
    159     (foldl
    160       (lambda (ls wrd)
    161         (if (hash-table-exists? word-tbl wrd) (cons wrd ls) ls) )
    162       '()
    163       other-word-list) ) )
     157  (begin
     158    (import (srfi 69))
     159    (let* ((word-list (read-file "bloom-filter-word-list.txt"))
     160           (word-tbl (alist->hash-table (map (cut cons <> #t) word-list)))
     161           (other-word-list (map string-reverse word-list)) )
     162      (foldl
     163        (lambda (ls wrd)
     164          (if (hash-table-exists? word-tbl wrd) (cons wrd ls) ls) )
     165        '()
     166        other-word-list))))
    164167
    165168(define-syntax test-success
     
    186189      (bf #f)
    187190      (false-positives '()) )
     191
    188192  (test-group "Words In List, All K"
    189193
     
    214218      (bf #f)
    215219      (false-positives '()) )
     220
    216221  (test-group "Words In List, Actual K"
    217222    (test-assert (actual-k mdps))
     
    235240      (every (cut bloom-filter-exists? bf <>) word-list))
    236241
    237     #;(test-success "False positives"
     242    ;#;
     243    (test-success "False positives"
    238244      (set! false-positives
    239245        (filter (cut bloom-filter-exists? bf <>) other-word-list)))
    240246
    241     ; "enola" crops up sometimes
    242     ;(glossf "Calced Palindromic words: ~A" (sort false-positives string<?))
    243     ;(glossf "Actual Palindromic words: ~A" palindromic-word-list)
    244     ;(test (length palindromic-word-list) (length false-positives))
     247    ;"enola" crops up sometimes ?
     248    (glossf "Calced Palindromic words: ~A" (sort false-positives string<?))
     249    (glossf "Actual Palindromic words: ~A" palindromic-word-list)
     250    (test (length palindromic-word-list) (length false-positives))
    245251  ) )
    246252
     
    248254      (bf #f)
    249255      (false-positives '()) )
     256
    250257  (test-group "Words In List, Optimal K"
    251258    (test-assert (= 3 (length (receive (desired-m P N)))))
     
    261268      (set! false-positives
    262269        (filter (cut bloom-filter-exists? bf <>) other-word-list)))
     270
    263271    (glossf "Calced Palindromic words: ~A" (sort false-positives string<?))
    264272    (glossf "Actual Palindromic words: ~A" palindromic-word-list)
Note: See TracChangeset for help on using the changeset viewer.