isomorfeus-ferret 0.17.2 → 0.17.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/isomorfeus_ferret_ext/benchmark.c +9 -20
- data/ext/isomorfeus_ferret_ext/benchmarks_all.h +1 -2
- data/ext/isomorfeus_ferret_ext/bm_hash.c +1 -2
- data/ext/isomorfeus_ferret_ext/brotli_dec_decode.c +4 -2
- data/ext/isomorfeus_ferret_ext/brotli_enc_encode.c +3 -2
- data/ext/isomorfeus_ferret_ext/frb_analysis.c +4 -5
- data/ext/isomorfeus_ferret_ext/frb_field_info.c +3 -4
- data/ext/isomorfeus_ferret_ext/frb_index.c +118 -125
- data/ext/isomorfeus_ferret_ext/frb_lazy_doc.c +14 -16
- data/ext/isomorfeus_ferret_ext/frb_search.c +31 -23
- data/ext/isomorfeus_ferret_ext/frb_store.c +27 -13
- data/ext/isomorfeus_ferret_ext/frb_utils.c +3 -6
- data/ext/isomorfeus_ferret_ext/frt_analysis.c +39 -46
- data/ext/isomorfeus_ferret_ext/frt_analysis.h +9 -9
- data/ext/isomorfeus_ferret_ext/frt_array.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_bitvector.h +3 -6
- data/ext/isomorfeus_ferret_ext/frt_doc_field.c +87 -0
- data/ext/isomorfeus_ferret_ext/frt_doc_field.h +26 -0
- data/ext/isomorfeus_ferret_ext/frt_document.c +4 -97
- data/ext/isomorfeus_ferret_ext/frt_document.h +2 -27
- data/ext/isomorfeus_ferret_ext/frt_except.c +8 -6
- data/ext/isomorfeus_ferret_ext/frt_except.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_field_index.c +13 -32
- data/ext/isomorfeus_ferret_ext/frt_field_index.h +0 -6
- data/ext/isomorfeus_ferret_ext/frt_field_info.c +69 -0
- data/ext/isomorfeus_ferret_ext/frt_field_info.h +49 -0
- data/ext/isomorfeus_ferret_ext/frt_field_infos.c +196 -0
- data/ext/isomorfeus_ferret_ext/frt_field_infos.h +35 -0
- data/ext/isomorfeus_ferret_ext/frt_global.c +10 -4
- data/ext/isomorfeus_ferret_ext/frt_global.h +11 -15
- data/ext/isomorfeus_ferret_ext/frt_hash.c +8 -8
- data/ext/isomorfeus_ferret_ext/frt_hash.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_hashset.c +20 -40
- data/ext/isomorfeus_ferret_ext/frt_hashset.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_helper.c +7 -15
- data/ext/isomorfeus_ferret_ext/frt_in_stream.c +35 -45
- data/ext/isomorfeus_ferret_ext/frt_in_stream.h +3 -2
- data/ext/isomorfeus_ferret_ext/frt_ind.c +20 -38
- data/ext/isomorfeus_ferret_ext/frt_index.c +292 -790
- data/ext/isomorfeus_ferret_ext/frt_index.h +1 -102
- data/ext/isomorfeus_ferret_ext/frt_lang.c +5 -10
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.c +3 -3
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc.h +1 -1
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.c +18 -25
- data/ext/isomorfeus_ferret_ext/frt_lazy_doc_field.h +5 -5
- data/ext/isomorfeus_ferret_ext/frt_mdbx_store.c +102 -70
- data/ext/isomorfeus_ferret_ext/frt_mempool.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_multimapper.c +23 -46
- data/ext/isomorfeus_ferret_ext/frt_multimapper.h +4 -8
- data/ext/isomorfeus_ferret_ext/frt_out_stream.c +31 -43
- data/ext/isomorfeus_ferret_ext/frt_out_stream.h +2 -2
- data/ext/isomorfeus_ferret_ext/frt_posh.c +6 -819
- data/ext/isomorfeus_ferret_ext/frt_posh.h +0 -57
- data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +85 -171
- data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_q_parser.c +49 -98
- data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +52 -104
- data/ext/isomorfeus_ferret_ext/frt_q_range.c +6 -12
- data/ext/isomorfeus_ferret_ext/frt_q_span.c +113 -226
- data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +1 -2
- data/ext/isomorfeus_ferret_ext/frt_ram_store.c +134 -85
- data/ext/isomorfeus_ferret_ext/frt_search.c +82 -164
- data/ext/isomorfeus_ferret_ext/frt_similarity.c +11 -22
- data/ext/isomorfeus_ferret_ext/frt_similarity.h +1 -2
- data/ext/isomorfeus_ferret_ext/frt_store.c +13 -25
- data/ext/isomorfeus_ferret_ext/frt_store.h +86 -52
- data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +8 -16
- data/ext/isomorfeus_ferret_ext/frt_win32.h +5 -10
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +12 -11
- data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +11 -13
- data/ext/isomorfeus_ferret_ext/lz4.c +422 -195
- data/ext/isomorfeus_ferret_ext/lz4.h +114 -46
- data/ext/isomorfeus_ferret_ext/lz4frame.c +421 -242
- data/ext/isomorfeus_ferret_ext/lz4frame.h +122 -53
- data/ext/isomorfeus_ferret_ext/lz4hc.c +127 -111
- data/ext/isomorfeus_ferret_ext/lz4hc.h +14 -14
- data/ext/isomorfeus_ferret_ext/lz4xxhash.h +1 -1
- data/ext/isomorfeus_ferret_ext/mdbx.c +3762 -2526
- data/ext/isomorfeus_ferret_ext/mdbx.h +115 -70
- data/ext/isomorfeus_ferret_ext/test.c +40 -87
- data/ext/isomorfeus_ferret_ext/test.h +3 -6
- data/ext/isomorfeus_ferret_ext/test_1710.c +11 -13
- data/ext/isomorfeus_ferret_ext/test_analysis.c +32 -64
- data/ext/isomorfeus_ferret_ext/test_array.c +6 -12
- data/ext/isomorfeus_ferret_ext/test_bitvector.c +12 -24
- data/ext/isomorfeus_ferret_ext/test_document.c +23 -33
- data/ext/isomorfeus_ferret_ext/test_except.c +10 -21
- data/ext/isomorfeus_ferret_ext/test_fields.c +62 -68
- data/ext/isomorfeus_ferret_ext/test_file_deleter.c +15 -23
- data/ext/isomorfeus_ferret_ext/test_filter.c +17 -27
- data/ext/isomorfeus_ferret_ext/test_global.c +14 -29
- data/ext/isomorfeus_ferret_ext/test_hash.c +19 -38
- data/ext/isomorfeus_ferret_ext/test_hashset.c +8 -16
- data/ext/isomorfeus_ferret_ext/test_helper.c +4 -8
- data/ext/isomorfeus_ferret_ext/test_highlighter.c +16 -28
- data/ext/isomorfeus_ferret_ext/test_index.c +277 -487
- data/ext/isomorfeus_ferret_ext/test_lang.c +7 -14
- data/ext/isomorfeus_ferret_ext/test_mdbx_store.c +2 -5
- data/ext/isomorfeus_ferret_ext/test_mempool.c +5 -10
- data/ext/isomorfeus_ferret_ext/test_multimapper.c +3 -6
- data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +9 -18
- data/ext/isomorfeus_ferret_ext/test_q_const_score.c +4 -6
- data/ext/isomorfeus_ferret_ext/test_q_filtered.c +3 -4
- data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +9 -15
- data/ext/isomorfeus_ferret_ext/test_q_parser.c +8 -16
- data/ext/isomorfeus_ferret_ext/test_q_span.c +19 -35
- data/ext/isomorfeus_ferret_ext/test_ram_store.c +14 -13
- data/ext/isomorfeus_ferret_ext/test_search.c +60 -109
- data/ext/isomorfeus_ferret_ext/test_segments.c +8 -13
- data/ext/isomorfeus_ferret_ext/test_similarity.c +2 -4
- data/ext/isomorfeus_ferret_ext/test_sort.c +14 -24
- data/ext/isomorfeus_ferret_ext/test_store.c +96 -115
- data/ext/isomorfeus_ferret_ext/test_term.c +9 -15
- data/ext/isomorfeus_ferret_ext/test_term_vectors.c +9 -14
- data/ext/isomorfeus_ferret_ext/test_test.c +4 -8
- data/ext/isomorfeus_ferret_ext/test_threading.c +14 -20
- data/ext/isomorfeus_ferret_ext/testhelper.c +11 -21
- data/ext/isomorfeus_ferret_ext/testhelper.h +1 -1
- data/ext/isomorfeus_ferret_ext/tests_all.h +1 -2
- data/lib/isomorfeus/ferret/index/index.rb +1 -1
- data/lib/isomorfeus/ferret/version.rb +1 -1
- metadata +24 -4
@@ -12,8 +12,7 @@
|
|
12
12
|
* A test suite is a linked-list of sub-suites that are made up of test cases
|
13
13
|
* which contain a list of assertions.
|
14
14
|
*/
|
15
|
-
typedef struct TestSubSuite
|
16
|
-
{
|
15
|
+
typedef struct TestSubSuite {
|
17
16
|
char *name;
|
18
17
|
int num_test;
|
19
18
|
int failed;
|
@@ -22,14 +21,12 @@ typedef struct TestSubSuite
|
|
22
21
|
struct TestSubSuite *next;
|
23
22
|
} TestSubSuite;
|
24
23
|
|
25
|
-
typedef struct TestSuite
|
26
|
-
{
|
24
|
+
typedef struct TestSuite {
|
27
25
|
TestSubSuite *head;
|
28
26
|
TestSubSuite *tail;
|
29
27
|
} TestSuite;
|
30
28
|
|
31
|
-
typedef struct TestCase
|
32
|
-
{
|
29
|
+
typedef struct TestCase {
|
33
30
|
const char *name;
|
34
31
|
int failed;
|
35
32
|
TestSubSuite *suite;
|
@@ -10,8 +10,7 @@ static FrtFieldInfos *create_fis(void) {
|
|
10
10
|
return fis;
|
11
11
|
}
|
12
12
|
|
13
|
-
static FrtIndexWriter *create_iw(FrtStore *store)
|
14
|
-
{
|
13
|
+
static FrtIndexWriter *create_iw(FrtStore *store) {
|
15
14
|
FrtFieldInfos *fis = create_fis();
|
16
15
|
frt_index_create(store, fis);
|
17
16
|
frt_fis_deref(fis);
|
@@ -25,32 +24,31 @@ static FrtDocument *prep_doc(void) {
|
|
25
24
|
doc,
|
26
25
|
frt_df_add_data(
|
27
26
|
frt_df_new(rb_intern("content")),
|
28
|
-
|
27
|
+
"http://_____________________________________________________",
|
29
28
|
enc
|
30
29
|
)
|
31
|
-
)
|
30
|
+
);
|
32
31
|
return doc;
|
33
32
|
}
|
34
33
|
|
35
|
-
static void test_problem_text(TestCase *tc, void *data)
|
36
|
-
{
|
34
|
+
static void test_problem_text(TestCase *tc, void *data) {
|
37
35
|
FrtStore *store = (FrtStore *)data;
|
38
36
|
FrtIndexWriter *iw = create_iw(store);
|
39
37
|
FrtDocument *problem_text = prep_doc();
|
40
38
|
|
41
39
|
frt_iw_add_doc(iw, problem_text);
|
42
40
|
Aiequal(1, frt_iw_doc_count(iw));
|
43
|
-
Assert(!store->exists(store, "_0.fdx"), "data shouldn't have been written yet");
|
41
|
+
Assert(!store->exists(store, segm_idx_name, "_0.fdx"), "data shouldn't have been written yet");
|
44
42
|
frt_iw_commit(iw);
|
45
|
-
Assert(store->exists(store, "_0.fdx"), "data should now be written");
|
43
|
+
Assert(store->exists(store, segm_idx_name, "_0.fdx"), "data should now be written");
|
46
44
|
frt_iw_close(iw);
|
47
|
-
Assert(store->exists(store, "_0.fdx"), "data should still be there");
|
45
|
+
Assert(store->exists(store, segm_idx_name, "_0.fdx"), "data should still be there");
|
48
46
|
}
|
49
47
|
|
50
|
-
TestSuite *ts_1710(TestSuite *suite)
|
51
|
-
|
52
|
-
|
53
|
-
|
48
|
+
TestSuite *ts_1710(TestSuite *suite) {
|
49
|
+
FrtStore *store = frt_open_mdbx_store("./test/testdir/1710_store");
|
50
|
+
store->create_folder(store, segm_idx_name);
|
51
|
+
|
54
52
|
suite = ADD_SUITE(suite);
|
55
53
|
|
56
54
|
tst_run_test(suite, test_problem_text, store);
|
@@ -8,8 +8,7 @@ extern rb_encoding *utf8_encoding;
|
|
8
8
|
#define test_token(mtk, mstr, mstart, mend, menc) \
|
9
9
|
tt_token(mtk, mstr, mstart, mend, menc, tc, __LINE__)
|
10
10
|
|
11
|
-
static void tt_token(FrtToken *tk, const char *str, int start, int end, rb_encoding * enc, TestCase *tc, int line_num)
|
12
|
-
{
|
11
|
+
static void tt_token(FrtToken *tk, const char *str, int start, int end, rb_encoding * enc, TestCase *tc, int line_num) {
|
13
12
|
FrtToken frt_tk_exp;
|
14
13
|
static char buf[3000];
|
15
14
|
if (tk == NULL) {
|
@@ -26,8 +25,7 @@ static void tt_token(FrtToken *tk, const char *str, int start, int end, rb_encod
|
|
26
25
|
tst_int_equal(line_num, tc, strlen(tk->text), tk->len);
|
27
26
|
}
|
28
27
|
|
29
|
-
static void tt_token_pi(FrtToken *tk, const char *str, int start, int end, int pi, rb_encoding *enc, TestCase *tc, int line_num)
|
30
|
-
{
|
28
|
+
static void tt_token_pi(FrtToken *tk, const char *str, int start, int end, int pi, rb_encoding *enc, TestCase *tc, int line_num) {
|
31
29
|
FrtToken frt_tk_exp;
|
32
30
|
static char buf[3000];
|
33
31
|
if (tk == NULL) {
|
@@ -51,8 +49,7 @@ static void tt_token_pi(FrtToken *tk, const char *str, int start, int end, int p
|
|
51
49
|
#define test_token_pi(mtk, mstr, mstart, mend, mpi, menc) \
|
52
50
|
tt_token_pi(mtk, mstr, mstart, mend, mpi, menc, tc, __LINE__)
|
53
51
|
|
54
|
-
static void test_tk(TestCase *tc, void *data)
|
55
|
-
{
|
52
|
+
static void test_tk(TestCase *tc, void *data) {
|
56
53
|
FrtToken *tk1 = frt_tk_new();
|
57
54
|
FrtToken *tk2 = frt_tk_new();
|
58
55
|
rb_encoding *enc = rb_enc_find("ASCII-8BIT");
|
@@ -100,8 +97,7 @@ static void test_tk(TestCase *tc, void *data)
|
|
100
97
|
*
|
101
98
|
****************************************************************************/
|
102
99
|
|
103
|
-
static void test_non_tokenizer(TestCase *tc, void *data)
|
104
|
-
{
|
100
|
+
static void test_non_tokenizer(TestCase *tc, void *data) {
|
105
101
|
FrtToken *tk = frt_tk_new();
|
106
102
|
FrtTokenStream *ts = frt_non_tokenizer_new();
|
107
103
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -118,8 +114,7 @@ static void test_non_tokenizer(TestCase *tc, void *data)
|
|
118
114
|
frt_ts_deref(ts);
|
119
115
|
}
|
120
116
|
|
121
|
-
static void test_non_analyzer(TestCase *tc, void *data)
|
122
|
-
{
|
117
|
+
static void test_non_analyzer(TestCase *tc, void *data) {
|
123
118
|
FrtToken *tk = frt_tk_new();
|
124
119
|
FrtAnalyzer *a = frt_non_analyzer_new();
|
125
120
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -140,8 +135,7 @@ static void test_non_analyzer(TestCase *tc, void *data)
|
|
140
135
|
*
|
141
136
|
****************************************************************************/
|
142
137
|
|
143
|
-
static void test_whitespace_tokenizer(TestCase *tc, void *data)
|
144
|
-
{
|
138
|
+
static void test_whitespace_tokenizer(TestCase *tc, void *data) {
|
145
139
|
FrtToken *tk = frt_tk_new();
|
146
140
|
FrtTokenStream *ts = frt_whitespace_tokenizer_new();
|
147
141
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -165,8 +159,7 @@ static void test_whitespace_tokenizer(TestCase *tc, void *data)
|
|
165
159
|
frt_ts_deref(ts);
|
166
160
|
}
|
167
161
|
|
168
|
-
static void test_mb_whitespace_tokenizer(TestCase *tc, void *data)
|
169
|
-
{
|
162
|
+
static void test_mb_whitespace_tokenizer(TestCase *tc, void *data) {
|
170
163
|
FrtToken *tk = frt_tk_new();
|
171
164
|
FrtTokenStream *ts = frt_whitespace_tokenizer_new();
|
172
165
|
char text[100] = "DBalmän@gmail.com is My e-mail 52 #$ address. 23#!$ ÁÄGÇ®ÊË̯ÚØìÖÎÍ";
|
@@ -217,8 +210,7 @@ static void test_mb_whitespace_tokenizer(TestCase *tc, void *data)
|
|
217
210
|
frt_tk_destroy(tk);
|
218
211
|
}
|
219
212
|
|
220
|
-
static void test_whitespace_analyzer(TestCase *tc, void *data)
|
221
|
-
{
|
213
|
+
static void test_whitespace_analyzer(TestCase *tc, void *data) {
|
222
214
|
FrtToken *tk = frt_tk_new();
|
223
215
|
FrtAnalyzer *a = frt_whitespace_analyzer_new(false);
|
224
216
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -240,8 +232,7 @@ static void test_whitespace_analyzer(TestCase *tc, void *data)
|
|
240
232
|
frt_a_deref(a);
|
241
233
|
}
|
242
234
|
|
243
|
-
static void test_mb_whitespace_analyzer(TestCase *tc, void *data)
|
244
|
-
{
|
235
|
+
static void test_mb_whitespace_analyzer(TestCase *tc, void *data) {
|
245
236
|
FrtToken *tk = frt_tk_new();
|
246
237
|
FrtAnalyzer *a = frt_whitespace_analyzer_new(false);
|
247
238
|
char text[100] = "DBalmän@gmail.com is My e-mail 52 #$ address. 23#!$ ÁÄGÇ®ÊË̯ÚØìÖÎÍ";
|
@@ -285,8 +276,7 @@ static void test_mb_whitespace_analyzer(TestCase *tc, void *data)
|
|
285
276
|
*
|
286
277
|
****************************************************************************/
|
287
278
|
|
288
|
-
static void test_letter_tokenizer(TestCase *tc, void *data)
|
289
|
-
{
|
279
|
+
static void test_letter_tokenizer(TestCase *tc, void *data) {
|
290
280
|
FrtToken *tk = frt_tk_new();
|
291
281
|
FrtTokenStream *ts = frt_letter_tokenizer_new();
|
292
282
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -310,8 +300,7 @@ static void test_letter_tokenizer(TestCase *tc, void *data)
|
|
310
300
|
frt_ts_deref(ts);
|
311
301
|
}
|
312
302
|
|
313
|
-
static void test_mb_letter_tokenizer(TestCase *tc, void *data)
|
314
|
-
{
|
303
|
+
static void test_mb_letter_tokenizer(TestCase *tc, void *data) {
|
315
304
|
FrtToken *tk = frt_tk_new();
|
316
305
|
FrtTokenStream *ts = frt_letter_tokenizer_new();
|
317
306
|
char text[100] = "DBalmän@gmail.com is My e-mail 52 #$ address. 23#!$ ÁÄGÇ®ÊË̯ÚØìÖÎÍ";
|
@@ -371,8 +360,7 @@ static void test_mb_letter_tokenizer(TestCase *tc, void *data)
|
|
371
360
|
frt_tk_destroy(tk);
|
372
361
|
}
|
373
362
|
|
374
|
-
static void test_letter_analyzer(TestCase *tc, void *data)
|
375
|
-
{
|
363
|
+
static void test_letter_analyzer(TestCase *tc, void *data) {
|
376
364
|
FrtToken *tk = frt_tk_new();
|
377
365
|
FrtAnalyzer *a = frt_letter_analyzer_new(true);
|
378
366
|
char text[100] = "DBalmain@gmail.com is My e-mail 52 #$ address. 23#!$";
|
@@ -394,8 +382,7 @@ static void test_letter_analyzer(TestCase *tc, void *data)
|
|
394
382
|
frt_a_deref(a);
|
395
383
|
}
|
396
384
|
|
397
|
-
static void test_mb_letter_analyzer(TestCase *tc, void *data)
|
398
|
-
{
|
385
|
+
static void test_mb_letter_analyzer(TestCase *tc, void *data) {
|
399
386
|
FrtToken *tk = frt_tk_new();
|
400
387
|
FrtAnalyzer *a = frt_letter_analyzer_new(false);
|
401
388
|
char text[100] =
|
@@ -447,8 +434,7 @@ static void test_mb_letter_analyzer(TestCase *tc, void *data)
|
|
447
434
|
*
|
448
435
|
****************************************************************************/
|
449
436
|
|
450
|
-
static void do_standard_tokenizer(TestCase *tc, FrtTokenStream *ts)
|
451
|
-
{
|
437
|
+
static void do_standard_tokenizer(TestCase *tc, FrtTokenStream *ts) {
|
452
438
|
FrtToken *tk = frt_tk_new();
|
453
439
|
char text[200] =
|
454
440
|
"DBalmain@gmail.com is My e-mail -52 #$ Address. 23#!$ "
|
@@ -488,24 +474,21 @@ static void do_standard_tokenizer(TestCase *tc, FrtTokenStream *ts)
|
|
488
474
|
Assert(frt_ts_next(ts) == NULL, "Should be no more tokens");
|
489
475
|
}
|
490
476
|
|
491
|
-
static void test_standard_tokenizer(TestCase *tc, void *data)
|
492
|
-
{
|
477
|
+
static void test_standard_tokenizer(TestCase *tc, void *data) {
|
493
478
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
494
479
|
(void)data;
|
495
480
|
do_standard_tokenizer(tc, ts);
|
496
481
|
frt_ts_deref(ts);
|
497
482
|
}
|
498
483
|
|
499
|
-
static void test_legacy_standard_tokenizer(TestCase *tc, void *data)
|
500
|
-
{
|
484
|
+
static void test_legacy_standard_tokenizer(TestCase *tc, void *data) {
|
501
485
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
502
486
|
(void)data;
|
503
487
|
do_standard_tokenizer(tc, ts);
|
504
488
|
frt_ts_deref(ts);
|
505
489
|
}
|
506
490
|
|
507
|
-
static void do_mb_standard_tokenizer(TestCase *tc, FrtTokenStream *ts)
|
508
|
-
{
|
491
|
+
static void do_mb_standard_tokenizer(TestCase *tc, FrtTokenStream *ts) {
|
509
492
|
FrtToken *tk = frt_tk_new();
|
510
493
|
char text[512] =
|
511
494
|
"DBalmain@gmail.com is My e-mail -52 #$ Address. 23#!$ "
|
@@ -579,24 +562,21 @@ static void do_mb_standard_tokenizer(TestCase *tc, FrtTokenStream *ts)
|
|
579
562
|
"xxxxxxxxxxxxxxxxxxx", 0, 348, enc);
|
580
563
|
}
|
581
564
|
|
582
|
-
static void test_mb_standard_tokenizer(TestCase *tc, void *data)
|
583
|
-
{
|
565
|
+
static void test_mb_standard_tokenizer(TestCase *tc, void *data) {
|
584
566
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
585
567
|
(void)data;
|
586
568
|
do_mb_standard_tokenizer(tc, ts);
|
587
569
|
frt_ts_deref(ts);
|
588
570
|
}
|
589
571
|
|
590
|
-
static void test_mb_legacy_standard_tokenizer(TestCase *tc, void *data)
|
591
|
-
{
|
572
|
+
static void test_mb_legacy_standard_tokenizer(TestCase *tc, void *data) {
|
592
573
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
593
574
|
(void)data;
|
594
575
|
do_mb_standard_tokenizer(tc, ts);
|
595
576
|
frt_ts_deref(ts);
|
596
577
|
}
|
597
578
|
|
598
|
-
static void test_standard_analyzer(TestCase *tc, void *data)
|
599
|
-
{
|
579
|
+
static void test_standard_analyzer(TestCase *tc, void *data) {
|
600
580
|
FrtToken *tk = frt_tk_new();
|
601
581
|
FrtAnalyzer *a = frt_standard_analyzer_new_with_words(true, FRT_ENGLISH_STOP_WORDS);
|
602
582
|
char text[200] =
|
@@ -622,8 +602,7 @@ static void test_standard_analyzer(TestCase *tc, void *data)
|
|
622
602
|
frt_a_deref(a);
|
623
603
|
}
|
624
604
|
|
625
|
-
static void test_mb_standard_analyzer(TestCase *tc, void *data)
|
626
|
-
{
|
605
|
+
static void test_mb_standard_analyzer(TestCase *tc, void *data) {
|
627
606
|
FrtToken *tk = frt_tk_new();
|
628
607
|
FrtAnalyzer *a =
|
629
608
|
frt_standard_analyzer_new_with_words(false, FRT_ENGLISH_STOP_WORDS);
|
@@ -721,8 +700,7 @@ static void test_mb_standard_analyzer(TestCase *tc, void *data)
|
|
721
700
|
frt_tk_destroy(tk);
|
722
701
|
}
|
723
702
|
|
724
|
-
static void test_legacy_standard_analyzer(TestCase *tc, void *data)
|
725
|
-
{
|
703
|
+
static void test_legacy_standard_analyzer(TestCase *tc, void *data) {
|
726
704
|
FrtToken *tk = frt_tk_new();
|
727
705
|
FrtAnalyzer *a =
|
728
706
|
frt_standard_analyzer_new_with_words(true, FRT_ENGLISH_STOP_WORDS);
|
@@ -749,8 +727,7 @@ static void test_legacy_standard_analyzer(TestCase *tc, void *data)
|
|
749
727
|
frt_a_deref(a);
|
750
728
|
}
|
751
729
|
|
752
|
-
static void test_mb_legacy_standard_analyzer(TestCase *tc, void *data)
|
753
|
-
{
|
730
|
+
static void test_mb_legacy_standard_analyzer(TestCase *tc, void *data) {
|
754
731
|
FrtToken *tk = frt_tk_new();
|
755
732
|
FrtAnalyzer *a =
|
756
733
|
frt_standard_analyzer_new_with_words(false, FRT_ENGLISH_STOP_WORDS);
|
@@ -848,8 +825,7 @@ static void test_mb_legacy_standard_analyzer(TestCase *tc, void *data)
|
|
848
825
|
frt_tk_destroy(tk);
|
849
826
|
}
|
850
827
|
|
851
|
-
static void test_long_word(TestCase *tc, void *data)
|
852
|
-
{
|
828
|
+
static void test_long_word(TestCase *tc, void *data) {
|
853
829
|
FrtToken *tk = frt_tk_new();
|
854
830
|
FrtAnalyzer *a = frt_standard_analyzer_new_with_words(true, FRT_ENGLISH_STOP_WORDS);
|
855
831
|
char text[400] =
|
@@ -889,8 +865,7 @@ static void test_long_word(TestCase *tc, void *data)
|
|
889
865
|
*
|
890
866
|
****************************************************************************/
|
891
867
|
|
892
|
-
static void test_lowercase_filter(TestCase *tc, void *data)
|
893
|
-
{
|
868
|
+
static void test_lowercase_filter(TestCase *tc, void *data) {
|
894
869
|
FrtToken *tk = frt_tk_new();
|
895
870
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
896
871
|
ts = frt_lowercase_filter_new(ts);
|
@@ -918,8 +893,7 @@ static void test_lowercase_filter(TestCase *tc, void *data)
|
|
918
893
|
frt_ts_deref(ts);
|
919
894
|
}
|
920
895
|
|
921
|
-
static void test_hyphen_filter(TestCase *tc, void *data)
|
922
|
-
{
|
896
|
+
static void test_hyphen_filter(TestCase *tc, void *data) {
|
923
897
|
FrtToken *tk = frt_tk_new();
|
924
898
|
FrtTokenStream *ts = frt_standard_tokenizer_new();
|
925
899
|
ts = frt_lowercase_filter_new(ts);
|
@@ -958,8 +932,7 @@ static void test_hyphen_filter(TestCase *tc, void *data)
|
|
958
932
|
}
|
959
933
|
|
960
934
|
const char *words[] = { "one", "four", "five", "seven", NULL };
|
961
|
-
static void test_stop_filter(TestCase *tc, void *data)
|
962
|
-
{
|
935
|
+
static void test_stop_filter(TestCase *tc, void *data) {
|
963
936
|
FrtToken *tk = frt_tk_new();
|
964
937
|
FrtTokenStream *ts =
|
965
938
|
frt_stop_filter_new_with_words(frt_letter_tokenizer_new(), words);
|
@@ -984,8 +957,7 @@ static void test_stop_filter(TestCase *tc, void *data)
|
|
984
957
|
frt_ts_deref(ts);
|
985
958
|
}
|
986
959
|
|
987
|
-
static void test_mapping_filter(TestCase *tc, void *data)
|
988
|
-
{
|
960
|
+
static void test_mapping_filter(TestCase *tc, void *data) {
|
989
961
|
FrtToken *tk = frt_tk_new();
|
990
962
|
FrtTokenStream *ts = frt_mapping_filter_new(frt_letter_tokenizer_new());
|
991
963
|
char text[200] =
|
@@ -1038,8 +1010,7 @@ static void test_mapping_filter(TestCase *tc, void *data)
|
|
1038
1010
|
frt_ts_deref(ts);
|
1039
1011
|
}
|
1040
1012
|
|
1041
|
-
static void test_stemmer(TestCase *tc, void *data)
|
1042
|
-
{
|
1013
|
+
static void test_stemmer(TestCase *tc, void *data) {
|
1043
1014
|
int stemmer_cnt = 0;
|
1044
1015
|
const char **stemmers = sb_stemmer_list();
|
1045
1016
|
const char **st = stemmers;
|
@@ -1058,8 +1029,7 @@ static void test_stemmer(TestCase *tc, void *data)
|
|
1058
1029
|
Assert(stemmer_cnt >= 13, "There should be at least 10 stemmers");
|
1059
1030
|
}
|
1060
1031
|
|
1061
|
-
static void test_stem_filter(TestCase *tc, void *data)
|
1062
|
-
{
|
1032
|
+
static void test_stem_filter(TestCase *tc, void *data) {
|
1063
1033
|
FrtToken *tk = frt_tk_new();
|
1064
1034
|
FrtTokenStream *ts = frt_letter_tokenizer_new();
|
1065
1035
|
ts = frt_lowercase_filter_new(ts);
|
@@ -1100,8 +1070,7 @@ static void test_stem_filter(TestCase *tc, void *data)
|
|
1100
1070
|
frt_ts_deref(ts2);
|
1101
1071
|
}
|
1102
1072
|
|
1103
|
-
static void test_per_field_analyzer(TestCase *tc, void *data)
|
1104
|
-
{
|
1073
|
+
static void test_per_field_analyzer(TestCase *tc, void *data) {
|
1105
1074
|
FrtTokenStream *ts;
|
1106
1075
|
FrtToken *tk = frt_tk_new();
|
1107
1076
|
char text[100] = "DBalmain@gmail.com is My E-mail 52 #$ address. 23#!$";
|
@@ -1172,8 +1141,7 @@ static void test_per_field_analyzer(TestCase *tc, void *data)
|
|
1172
1141
|
frt_a_deref(pfa);
|
1173
1142
|
}
|
1174
1143
|
|
1175
|
-
TestSuite *ts_analysis(TestSuite *suite)
|
1176
|
-
{
|
1144
|
+
TestSuite *ts_analysis(TestSuite *suite) {
|
1177
1145
|
suite = ADD_SUITE(suite);
|
1178
1146
|
|
1179
1147
|
tst_run_test(suite, test_tk, NULL);
|
@@ -2,14 +2,12 @@
|
|
2
2
|
#include <string.h>
|
3
3
|
#include "test.h"
|
4
4
|
|
5
|
-
static void frt_ary_free_mock(void *p)
|
6
|
-
{
|
5
|
+
static void frt_ary_free_mock(void *p) {
|
7
6
|
char *str = (char *)p;
|
8
7
|
strcpy(str, "free");
|
9
8
|
}
|
10
9
|
|
11
|
-
static void test_ary(TestCase *tc, void *data)
|
12
|
-
{
|
10
|
+
static void test_ary(TestCase *tc, void *data) {
|
13
11
|
int i;
|
14
12
|
int raised = 0;
|
15
13
|
char *tmp;
|
@@ -156,8 +154,7 @@ static void test_ary(TestCase *tc, void *data)
|
|
156
154
|
frt_ary_free(ary);
|
157
155
|
}
|
158
156
|
|
159
|
-
void test_ary_destroy(TestCase *tc, void *data)
|
160
|
-
{
|
157
|
+
void test_ary_destroy(TestCase *tc, void *data) {
|
161
158
|
void **ary = frt_ary_new();
|
162
159
|
char str1[10] = "alloc1";
|
163
160
|
char str2[10] = "alloc2";
|
@@ -179,8 +176,7 @@ void test_ary_destroy(TestCase *tc, void *data)
|
|
179
176
|
}
|
180
177
|
|
181
178
|
#define ARY_STRESS_SIZE 1000
|
182
|
-
void stress_ary(TestCase *tc, void *data)
|
183
|
-
{
|
179
|
+
void stress_ary(TestCase *tc, void *data) {
|
184
180
|
int i;
|
185
181
|
char buf[100], *t;
|
186
182
|
void **ary = frt_ary_new();
|
@@ -217,8 +213,7 @@ struct TestPoint {
|
|
217
213
|
ary[i].y = y_val;\
|
218
214
|
} while (0)
|
219
215
|
|
220
|
-
void test_typed_ary(TestCase *tc, void *data)
|
221
|
-
{
|
216
|
+
void test_typed_ary(TestCase *tc, void *data) {
|
222
217
|
struct TestPoint *points = frt_ary_new_type_capa(struct TestPoint, 5);
|
223
218
|
(void)data;
|
224
219
|
|
@@ -259,8 +254,7 @@ void test_typed_ary(TestCase *tc, void *data)
|
|
259
254
|
frt_ary_free(points);
|
260
255
|
}
|
261
256
|
|
262
|
-
TestSuite *ts_array(TestSuite *suite)
|
263
|
-
{
|
257
|
+
TestSuite *ts_array(TestSuite *suite) {
|
264
258
|
suite = ADD_SUITE(suite);
|
265
259
|
|
266
260
|
tst_run_test(suite, test_ary, NULL);
|
@@ -7,8 +7,7 @@
|
|
7
7
|
#define BV_INT 33
|
8
8
|
|
9
9
|
#define SET_BITS_MAX_CNT 100
|
10
|
-
static FrtBitVector *set_bits(FrtBitVector *bv, const char *bits)
|
11
|
-
{
|
10
|
+
static FrtBitVector *set_bits(FrtBitVector *bv, const char *bits) {
|
12
11
|
static int bit_array[SET_BITS_MAX_CNT];
|
13
12
|
const int bit_cnt = s2l(bits, bit_array);
|
14
13
|
int i;
|
@@ -19,8 +18,7 @@ static FrtBitVector *set_bits(FrtBitVector *bv, const char *bits)
|
|
19
18
|
}
|
20
19
|
|
21
20
|
/*
|
22
|
-
static FrtBitVector *unset_bits(FrtBitVector *bv, char *bits)
|
23
|
-
{
|
21
|
+
static FrtBitVector *unset_bits(FrtBitVector *bv, char *bits) {
|
24
22
|
static int bit_array[SET_BITS_MAX_CNT];
|
25
23
|
const int bit_cnt = s2l(bits, bit_array);
|
26
24
|
int i;
|
@@ -34,8 +32,7 @@ static FrtBitVector *unset_bits(FrtBitVector *bv, char *bits)
|
|
34
32
|
/**
|
35
33
|
* Test basic FrtBitVector get/set/unset operations
|
36
34
|
*/
|
37
|
-
static void test_bv(TestCase *tc, void *data)
|
38
|
-
{
|
35
|
+
static void test_bv(TestCase *tc, void *data) {
|
39
36
|
int i;
|
40
37
|
FrtBitVector *bv = frt_bv_new();
|
41
38
|
(void)data; /* suppress unused argument warning */
|
@@ -125,8 +122,7 @@ static void test_bv(TestCase *tc, void *data)
|
|
125
122
|
/**
|
126
123
|
* Test simple FrtBitVector scanning
|
127
124
|
*/
|
128
|
-
static void test_bv_scan(TestCase *tc, void *data)
|
129
|
-
{
|
125
|
+
static void test_bv_scan(TestCase *tc, void *data) {
|
130
126
|
int i;
|
131
127
|
FrtBitVector *bv = frt_bv_new();
|
132
128
|
FrtBitVector *not_bv;
|
@@ -177,8 +173,7 @@ do { \
|
|
177
173
|
frt_bv_destroy(_not_bv1); frt_bv_destroy(_not_bv2); \
|
178
174
|
} while (0)
|
179
175
|
|
180
|
-
static void test_bv_eq_hash(TestCase *tc, void *data)
|
181
|
-
{
|
176
|
+
static void test_bv_eq_hash(TestCase *tc, void *data) {
|
182
177
|
static int const COUNT = 1000;
|
183
178
|
int i;
|
184
179
|
FrtBitVector *bv1 = frt_bv_new();
|
@@ -230,8 +225,7 @@ static void test_bv_eq_hash(TestCase *tc, void *data)
|
|
230
225
|
frt_bv_destroy(bv2);
|
231
226
|
}
|
232
227
|
|
233
|
-
static void test_bv_and(TestCase *tc, void *data)
|
234
|
-
{
|
228
|
+
static void test_bv_and(TestCase *tc, void *data) {
|
235
229
|
# define AND_SIZE 1000
|
236
230
|
static const int and_cnt = 500;
|
237
231
|
FrtBitVector *and_bv;
|
@@ -309,8 +303,7 @@ static void test_bv_and(TestCase *tc, void *data)
|
|
309
303
|
frt_bv_destroy(and_bv);
|
310
304
|
}
|
311
305
|
|
312
|
-
static void test_bv_or(TestCase *tc, void *data)
|
313
|
-
{
|
306
|
+
static void test_bv_or(TestCase *tc, void *data) {
|
314
307
|
# define OR_SIZE 1000
|
315
308
|
static const int or_cnt = 500;
|
316
309
|
FrtBitVector *or_bv;
|
@@ -362,8 +355,7 @@ static void test_bv_or(TestCase *tc, void *data)
|
|
362
355
|
frt_bv_destroy(or_bv);
|
363
356
|
}
|
364
357
|
|
365
|
-
static void test_bv_xor(TestCase *tc, void *data)
|
366
|
-
{
|
358
|
+
static void test_bv_xor(TestCase *tc, void *data) {
|
367
359
|
# define XOR_SIZE 1000
|
368
360
|
static const int xor_cnt = 500;
|
369
361
|
FrtBitVector *xor_bv;
|
@@ -422,8 +414,7 @@ static void test_bv_xor(TestCase *tc, void *data)
|
|
422
414
|
frt_bv_destroy(xor_bv);
|
423
415
|
}
|
424
416
|
|
425
|
-
static void test_bv_not(TestCase *tc, void *data)
|
426
|
-
{
|
417
|
+
static void test_bv_not(TestCase *tc, void *data) {
|
427
418
|
FrtBitVector *bv = frt_bv_new(), *not_bv;
|
428
419
|
int i;
|
429
420
|
(void)data;
|
@@ -443,8 +434,7 @@ static void test_bv_not(TestCase *tc, void *data)
|
|
443
434
|
frt_bv_destroy(not_bv);
|
444
435
|
}
|
445
436
|
|
446
|
-
static void test_bv_combined_boolean_ops(TestCase *tc, void *data)
|
447
|
-
{
|
437
|
+
static void test_bv_combined_boolean_ops(TestCase *tc, void *data) {
|
448
438
|
FrtBitVector *bv1 = frt_bv_new();
|
449
439
|
FrtBitVector *bv2 = frt_bv_new();
|
450
440
|
FrtBitVector *bv3;
|
@@ -508,8 +498,7 @@ static void test_bv_combined_boolean_ops(TestCase *tc, void *data)
|
|
508
498
|
* set to 97. When running this test with high numbers, be sure use -q on the
|
509
499
|
* command line or the test will take a very long time.
|
510
500
|
*/
|
511
|
-
static void test_bv_scan_stress(TestCase *tc, void *data)
|
512
|
-
{
|
501
|
+
static void test_bv_scan_stress(TestCase *tc, void *data) {
|
513
502
|
int i;
|
514
503
|
FrtBitVector *bv = frt_bv_new_capa(BV_SCAN_SIZE);
|
515
504
|
FrtBitVector *not_bv;
|
@@ -582,8 +571,7 @@ static void test_bv_scan_stress(TestCase *tc, void *data)
|
|
582
571
|
}
|
583
572
|
|
584
573
|
|
585
|
-
TestSuite *ts_bitvector(TestSuite *suite)
|
586
|
-
{
|
574
|
+
TestSuite *ts_bitvector(TestSuite *suite) {
|
587
575
|
suite = ADD_SUITE(suite);
|
588
576
|
|
589
577
|
tst_run_test(suite, test_bv, NULL);
|