Changeset 2142bb1f97bcd9f2283306e84852774fef71d55e

Show
Ignore:
Timestamp:
04/27/08 17:26:02 (8 months ago)
Author:
David Balmain <dbalmain@…>
Parents:
cf8e43eb3296c5f2e2681f89658e5b9b3c0dd263
Children:
15dee3043d3e551973defb68d67022123989c1fa
git-committer:
David Balmain <dbalmain@gmail.com> / 2008-04-27T17:26:02Z+1000
Message:

Improved PrefixQuery? coverage to 100% and minor tidy up

* improved gcov coverage of PrefixQuery? to 100%
* tidied up FuzzyQuery? tests
* tidied sort results from rake gcov. Now equal results are lexically sorted

Location:
c
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • c/Rakefile

    r53eafd r2142bb  
    115115$gcov_results   = OpenStruct.new(:files => {}) 
    116116def gcov_sorted_keys 
    117   $gcov_results.files.keys.sort_by {|fn| 
    118       $gcov_results.files[fn].percent 
     117  $gcov_results.files.keys.sort {|fn1, fn2| 
     118      res = $gcov_results.files[fn1].percent <=> 
     119            $gcov_results.files[fn2].percent 
     120      res = fn2 <=> fn1 if res == 0 
     121      res 
    119122  }.reverse 
    120123end 
  • c/test/test_q_fuzzy.c

    r190f7a r2142bb  
    169169 
    170170/** 
    171  * Test query hashing to to_s functionality 
     171 * Test query->to_s functionality 
     172 */ 
     173static void test_fuzzy_query_to_s(TestCase *tc, void *data) 
     174{ 
     175    Query *q; 
     176    (void)data; 
     177 
     178    q = fuzq_new_conf(I("A"), "a", 0.4f, 2, 100); 
     179    check_to_s(tc, q, I("A"), "a~0.4"); 
     180    check_to_s(tc, q, I("B"), "A:a~0.4"); 
     181    q_deref(q); 
     182 
     183    q = fuzq_new_conf(I("field"), "mispell", 0.5f, 2, 100); 
     184    check_to_s(tc, q, I("field"), "mispell~"); 
     185    check_to_s(tc, q, I("notfield"), "field:mispell~"); 
     186    q_deref(q); 
     187 
     188} 
     189 
     190/** 
     191 * Test query hashing functionality 
    172192 */ 
    173193static void test_fuzzy_query_hash(TestCase *tc, void *data) 
     
    178198    q1 = fuzq_new_conf(I("A"), "a", 0.4f, 2, 100); 
    179199    q2 = fuzq_new_conf(I("A"), "a", 0.4f, 2, 100); 
    180     check_to_s(tc, q1, I("A"), "a~0.4"); 
    181     check_to_s(tc, q1, I("B"), "A:a~0.4"); 
    182200 
    183201    Assert(q_eq(q1, q1), "Test same queries are equal"); 
     
    206224    q_deref(q2); 
    207225 
    208     q2 = fuzq_new_conf(I("field"), "mispell", 0.5f, 2, 100); 
    209     check_to_s(tc, q2, I("field"), "mispell~"); 
    210     check_to_s(tc, q2, I("notfield"), "field:mispell~"); 
    211     q_deref(q2); 
    212  
    213226    q_deref(q1); 
    214227} 
     
    225238    tst_run_test(suite, test_fuzziness_long, (void *)store); 
    226239    tst_run_test(suite, test_fuzzy_query_hash, (void *)store); 
     240    tst_run_test(suite, test_fuzzy_query_to_s, (void *)store); 
    227241 
    228242    store_deref(store); 
  • c/test/test_search.c

    rad7fae r2142bb  
    844844    prq = prefixq_new(cat, "cat1/sub2"); 
    845845    check_to_s(tc, prq, cat, "cat1/sub2*"); 
     846    prq->boost = 20.0f; 
     847    check_to_s(tc, prq, cat, "cat1/sub2*^20.0"); 
    846848    check_hits(tc, searcher, prq, "3, 4, 13, 15", -1); 
    847849    q_deref(prq);