Changeset 2142bb1f97bcd9f2283306e84852774fef71d55e
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r53eafd
|
r2142bb
|
|
| 115 | 115 | $gcov_results = OpenStruct.new(:files => {}) |
| 116 | 116 | def 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 |
| 119 | 122 | }.reverse |
| 120 | 123 | end |
-
|
r190f7a
|
r2142bb
|
|
| 169 | 169 | |
| 170 | 170 | /** |
| 171 | | * Test query hashing to to_s functionality |
| | 171 | * Test query->to_s functionality |
| | 172 | */ |
| | 173 | static 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 |
| 172 | 192 | */ |
| 173 | 193 | static void test_fuzzy_query_hash(TestCase *tc, void *data) |
| … |
… |
|
| 178 | 198 | q1 = fuzq_new_conf(I("A"), "a", 0.4f, 2, 100); |
| 179 | 199 | 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"); |
| 182 | 200 | |
| 183 | 201 | Assert(q_eq(q1, q1), "Test same queries are equal"); |
| … |
… |
|
| 206 | 224 | q_deref(q2); |
| 207 | 225 | |
| 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 | | |
| 213 | 226 | q_deref(q1); |
| 214 | 227 | } |
| … |
… |
|
| 225 | 238 | tst_run_test(suite, test_fuzziness_long, (void *)store); |
| 226 | 239 | tst_run_test(suite, test_fuzzy_query_hash, (void *)store); |
| | 240 | tst_run_test(suite, test_fuzzy_query_to_s, (void *)store); |
| 227 | 241 | |
| 228 | 242 | store_deref(store); |
-
|
rad7fae
|
r2142bb
|
|
| 844 | 844 | prq = prefixq_new(cat, "cat1/sub2"); |
| 845 | 845 | check_to_s(tc, prq, cat, "cat1/sub2*"); |
| | 846 | prq->boost = 20.0f; |
| | 847 | check_to_s(tc, prq, cat, "cat1/sub2*^20.0"); |
| 846 | 848 | check_hits(tc, searcher, prq, "3, 4, 13, 15", -1); |
| 847 | 849 | q_deref(prq); |