isomorfeus-ferret 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (222) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +612 -0
  3. data/README.md +44 -0
  4. data/ext/isomorfeus_ferret_ext/benchmark.c +223 -0
  5. data/ext/isomorfeus_ferret_ext/benchmark.h +45 -0
  6. data/ext/isomorfeus_ferret_ext/benchmarks_all.h +25 -0
  7. data/ext/isomorfeus_ferret_ext/bm_bitvector.c +123 -0
  8. data/ext/isomorfeus_ferret_ext/bm_hash.c +118 -0
  9. data/ext/isomorfeus_ferret_ext/bm_micro_string.c +40 -0
  10. data/ext/isomorfeus_ferret_ext/bm_store.c +93 -0
  11. data/ext/isomorfeus_ferret_ext/email.rl +21 -0
  12. data/ext/isomorfeus_ferret_ext/extconf.rb +5 -0
  13. data/ext/isomorfeus_ferret_ext/fio_tmpfile.h +53 -0
  14. data/ext/isomorfeus_ferret_ext/frb_analysis.c +2577 -0
  15. data/ext/isomorfeus_ferret_ext/frb_index.c +3457 -0
  16. data/ext/isomorfeus_ferret_ext/frb_lang.c +9 -0
  17. data/ext/isomorfeus_ferret_ext/frb_lang.h +17 -0
  18. data/ext/isomorfeus_ferret_ext/frb_qparser.c +629 -0
  19. data/ext/isomorfeus_ferret_ext/frb_search.c +4460 -0
  20. data/ext/isomorfeus_ferret_ext/frb_store.c +515 -0
  21. data/ext/isomorfeus_ferret_ext/frb_threading.h +30 -0
  22. data/ext/isomorfeus_ferret_ext/frb_utils.c +1127 -0
  23. data/ext/isomorfeus_ferret_ext/frt_analysis.c +1644 -0
  24. data/ext/isomorfeus_ferret_ext/frt_analysis.h +247 -0
  25. data/ext/isomorfeus_ferret_ext/frt_array.c +124 -0
  26. data/ext/isomorfeus_ferret_ext/frt_array.h +54 -0
  27. data/ext/isomorfeus_ferret_ext/frt_bitvector.c +95 -0
  28. data/ext/isomorfeus_ferret_ext/frt_bitvector.h +586 -0
  29. data/ext/isomorfeus_ferret_ext/frt_compound_io.c +374 -0
  30. data/ext/isomorfeus_ferret_ext/frt_config.h +44 -0
  31. data/ext/isomorfeus_ferret_ext/frt_document.c +134 -0
  32. data/ext/isomorfeus_ferret_ext/frt_document.h +52 -0
  33. data/ext/isomorfeus_ferret_ext/frt_except.c +95 -0
  34. data/ext/isomorfeus_ferret_ext/frt_except.h +188 -0
  35. data/ext/isomorfeus_ferret_ext/frt_field_index.c +233 -0
  36. data/ext/isomorfeus_ferret_ext/frt_field_index.h +42 -0
  37. data/ext/isomorfeus_ferret_ext/frt_filter.c +157 -0
  38. data/ext/isomorfeus_ferret_ext/frt_fs_store.c +502 -0
  39. data/ext/isomorfeus_ferret_ext/frt_global.c +427 -0
  40. data/ext/isomorfeus_ferret_ext/frt_global.h +290 -0
  41. data/ext/isomorfeus_ferret_ext/frt_hash.c +518 -0
  42. data/ext/isomorfeus_ferret_ext/frt_hash.h +466 -0
  43. data/ext/isomorfeus_ferret_ext/frt_hashset.c +191 -0
  44. data/ext/isomorfeus_ferret_ext/frt_hashset.h +206 -0
  45. data/ext/isomorfeus_ferret_ext/frt_helper.c +62 -0
  46. data/ext/isomorfeus_ferret_ext/frt_helper.h +13 -0
  47. data/ext/isomorfeus_ferret_ext/frt_ind.c +353 -0
  48. data/ext/isomorfeus_ferret_ext/frt_ind.h +54 -0
  49. data/ext/isomorfeus_ferret_ext/frt_index.c +6377 -0
  50. data/ext/isomorfeus_ferret_ext/frt_index.h +880 -0
  51. data/ext/isomorfeus_ferret_ext/frt_lang.c +104 -0
  52. data/ext/isomorfeus_ferret_ext/frt_lang.h +44 -0
  53. data/ext/isomorfeus_ferret_ext/frt_mempool.c +87 -0
  54. data/ext/isomorfeus_ferret_ext/frt_mempool.h +33 -0
  55. data/ext/isomorfeus_ferret_ext/frt_multimapper.c +349 -0
  56. data/ext/isomorfeus_ferret_ext/frt_multimapper.h +52 -0
  57. data/ext/isomorfeus_ferret_ext/frt_posh.c +1006 -0
  58. data/ext/isomorfeus_ferret_ext/frt_posh.h +973 -0
  59. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.c +147 -0
  60. data/ext/isomorfeus_ferret_ext/frt_priorityqueue.h +147 -0
  61. data/ext/isomorfeus_ferret_ext/frt_q_boolean.c +1612 -0
  62. data/ext/isomorfeus_ferret_ext/frt_q_const_score.c +157 -0
  63. data/ext/isomorfeus_ferret_ext/frt_q_filtered_query.c +209 -0
  64. data/ext/isomorfeus_ferret_ext/frt_q_fuzzy.c +281 -0
  65. data/ext/isomorfeus_ferret_ext/frt_q_match_all.c +147 -0
  66. data/ext/isomorfeus_ferret_ext/frt_q_multi_term.c +672 -0
  67. data/ext/isomorfeus_ferret_ext/frt_q_parser.c +3084 -0
  68. data/ext/isomorfeus_ferret_ext/frt_q_phrase.c +1182 -0
  69. data/ext/isomorfeus_ferret_ext/frt_q_prefix.c +98 -0
  70. data/ext/isomorfeus_ferret_ext/frt_q_range.c +665 -0
  71. data/ext/isomorfeus_ferret_ext/frt_q_span.c +2386 -0
  72. data/ext/isomorfeus_ferret_ext/frt_q_term.c +311 -0
  73. data/ext/isomorfeus_ferret_ext/frt_q_wildcard.c +166 -0
  74. data/ext/isomorfeus_ferret_ext/frt_ram_store.c +460 -0
  75. data/ext/isomorfeus_ferret_ext/frt_scanner.c +899 -0
  76. data/ext/isomorfeus_ferret_ext/frt_scanner.h +28 -0
  77. data/ext/isomorfeus_ferret_ext/frt_scanner_mb.c +6705 -0
  78. data/ext/isomorfeus_ferret_ext/frt_scanner_utf8.c +4419 -0
  79. data/ext/isomorfeus_ferret_ext/frt_search.c +1824 -0
  80. data/ext/isomorfeus_ferret_ext/frt_search.h +924 -0
  81. data/ext/isomorfeus_ferret_ext/frt_similarity.c +150 -0
  82. data/ext/isomorfeus_ferret_ext/frt_similarity.h +79 -0
  83. data/ext/isomorfeus_ferret_ext/frt_sort.c +796 -0
  84. data/ext/isomorfeus_ferret_ext/frt_stopwords.c +395 -0
  85. data/ext/isomorfeus_ferret_ext/frt_store.c +680 -0
  86. data/ext/isomorfeus_ferret_ext/frt_store.h +789 -0
  87. data/ext/isomorfeus_ferret_ext/frt_term_vectors.c +72 -0
  88. data/ext/isomorfeus_ferret_ext/frt_threading.h +23 -0
  89. data/ext/isomorfeus_ferret_ext/frt_win32.h +54 -0
  90. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.c +409 -0
  91. data/ext/isomorfeus_ferret_ext/isomorfeus_ferret.h +95 -0
  92. data/ext/isomorfeus_ferret_ext/libstemmer.c +93 -0
  93. data/ext/isomorfeus_ferret_ext/libstemmer.h +73 -0
  94. data/ext/isomorfeus_ferret_ext/q_parser.y +1366 -0
  95. data/ext/isomorfeus_ferret_ext/scanner.h +28 -0
  96. data/ext/isomorfeus_ferret_ext/scanner.in +43 -0
  97. data/ext/isomorfeus_ferret_ext/scanner.rl +84 -0
  98. data/ext/isomorfeus_ferret_ext/scanner_mb.rl +200 -0
  99. data/ext/isomorfeus_ferret_ext/scanner_utf8.rl +85 -0
  100. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.c +324 -0
  101. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_danish.h +7 -0
  102. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.c +610 -0
  103. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_dutch.h +6 -0
  104. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.c +1104 -0
  105. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_english.h +6 -0
  106. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.c +749 -0
  107. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_finnish.h +7 -0
  108. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.c +1233 -0
  109. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_french.h +6 -0
  110. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.c +490 -0
  111. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_german.h +6 -0
  112. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.c +1217 -0
  113. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_hungarian.h +7 -0
  114. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.c +1052 -0
  115. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_italian.h +6 -0
  116. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.c +283 -0
  117. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_norwegian.h +6 -0
  118. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.c +735 -0
  119. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_porter.h +6 -0
  120. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.c +1003 -0
  121. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_portuguese.h +7 -0
  122. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.c +1079 -0
  123. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_spanish.h +6 -0
  124. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.c +293 -0
  125. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_1_swedish.h +6 -0
  126. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.c +984 -0
  127. data/ext/isomorfeus_ferret_ext/stem_ISO_8859_2_romanian.h +6 -0
  128. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.c +686 -0
  129. data/ext/isomorfeus_ferret_ext/stem_KOI8_R_russian.h +6 -0
  130. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.c +325 -0
  131. data/ext/isomorfeus_ferret_ext/stem_UTF_8_danish.h +6 -0
  132. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.c +620 -0
  133. data/ext/isomorfeus_ferret_ext/stem_UTF_8_dutch.h +6 -0
  134. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.c +1111 -0
  135. data/ext/isomorfeus_ferret_ext/stem_UTF_8_english.h +6 -0
  136. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.c +754 -0
  137. data/ext/isomorfeus_ferret_ext/stem_UTF_8_finnish.h +6 -0
  138. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.c +1242 -0
  139. data/ext/isomorfeus_ferret_ext/stem_UTF_8_french.h +6 -0
  140. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.c +495 -0
  141. data/ext/isomorfeus_ferret_ext/stem_UTF_8_german.h +6 -0
  142. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.c +1220 -0
  143. data/ext/isomorfeus_ferret_ext/stem_UTF_8_hungarian.h +6 -0
  144. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.c +1059 -0
  145. data/ext/isomorfeus_ferret_ext/stem_UTF_8_italian.h +6 -0
  146. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.c +285 -0
  147. data/ext/isomorfeus_ferret_ext/stem_UTF_8_norwegian.h +6 -0
  148. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.c +741 -0
  149. data/ext/isomorfeus_ferret_ext/stem_UTF_8_porter.h +6 -0
  150. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.c +1009 -0
  151. data/ext/isomorfeus_ferret_ext/stem_UTF_8_portuguese.h +6 -0
  152. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.c +990 -0
  153. data/ext/isomorfeus_ferret_ext/stem_UTF_8_romanian.h +6 -0
  154. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.c +680 -0
  155. data/ext/isomorfeus_ferret_ext/stem_UTF_8_russian.h +6 -0
  156. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.c +1083 -0
  157. data/ext/isomorfeus_ferret_ext/stem_UTF_8_spanish.h +6 -0
  158. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.c +294 -0
  159. data/ext/isomorfeus_ferret_ext/stem_UTF_8_swedish.h +6 -0
  160. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.c +2191 -0
  161. data/ext/isomorfeus_ferret_ext/stem_UTF_8_turkish.h +6 -0
  162. data/ext/isomorfeus_ferret_ext/stem_api.c +66 -0
  163. data/ext/isomorfeus_ferret_ext/stem_api.h +26 -0
  164. data/ext/isomorfeus_ferret_ext/stem_header.h +57 -0
  165. data/ext/isomorfeus_ferret_ext/stem_modules.h +190 -0
  166. data/ext/isomorfeus_ferret_ext/stem_modules.txt +50 -0
  167. data/ext/isomorfeus_ferret_ext/stem_utilities.c +478 -0
  168. data/ext/isomorfeus_ferret_ext/test.c +850 -0
  169. data/ext/isomorfeus_ferret_ext/test.h +416 -0
  170. data/ext/isomorfeus_ferret_ext/test_1710.c +63 -0
  171. data/ext/isomorfeus_ferret_ext/test_analysis.c +1221 -0
  172. data/ext/isomorfeus_ferret_ext/test_array.c +272 -0
  173. data/ext/isomorfeus_ferret_ext/test_bitvector.c +600 -0
  174. data/ext/isomorfeus_ferret_ext/test_compound_io.c +170 -0
  175. data/ext/isomorfeus_ferret_ext/test_document.c +156 -0
  176. data/ext/isomorfeus_ferret_ext/test_except.c +244 -0
  177. data/ext/isomorfeus_ferret_ext/test_fields.c +522 -0
  178. data/ext/isomorfeus_ferret_ext/test_file_deleter.c +185 -0
  179. data/ext/isomorfeus_ferret_ext/test_filter.c +331 -0
  180. data/ext/isomorfeus_ferret_ext/test_fs_store.c +25 -0
  181. data/ext/isomorfeus_ferret_ext/test_global.c +299 -0
  182. data/ext/isomorfeus_ferret_ext/test_hash.c +485 -0
  183. data/ext/isomorfeus_ferret_ext/test_hashset.c +288 -0
  184. data/ext/isomorfeus_ferret_ext/test_helper.c +47 -0
  185. data/ext/isomorfeus_ferret_ext/test_highlighter.c +548 -0
  186. data/ext/isomorfeus_ferret_ext/test_index.c +2323 -0
  187. data/ext/isomorfeus_ferret_ext/test_lang.c +74 -0
  188. data/ext/isomorfeus_ferret_ext/test_mempool.c +102 -0
  189. data/ext/isomorfeus_ferret_ext/test_multimapper.c +64 -0
  190. data/ext/isomorfeus_ferret_ext/test_priorityqueue.c +213 -0
  191. data/ext/isomorfeus_ferret_ext/test_q_const_score.c +84 -0
  192. data/ext/isomorfeus_ferret_ext/test_q_filtered.c +61 -0
  193. data/ext/isomorfeus_ferret_ext/test_q_fuzzy.c +241 -0
  194. data/ext/isomorfeus_ferret_ext/test_q_parser.c +464 -0
  195. data/ext/isomorfeus_ferret_ext/test_q_span.c +575 -0
  196. data/ext/isomorfeus_ferret_ext/test_ram_store.c +77 -0
  197. data/ext/isomorfeus_ferret_ext/test_search.c +1874 -0
  198. data/ext/isomorfeus_ferret_ext/test_segments.c +167 -0
  199. data/ext/isomorfeus_ferret_ext/test_similarity.c +25 -0
  200. data/ext/isomorfeus_ferret_ext/test_sort.c +333 -0
  201. data/ext/isomorfeus_ferret_ext/test_store.c +591 -0
  202. data/ext/isomorfeus_ferret_ext/test_store.h +3 -0
  203. data/ext/isomorfeus_ferret_ext/test_term.c +351 -0
  204. data/ext/isomorfeus_ferret_ext/test_term_vectors.c +373 -0
  205. data/ext/isomorfeus_ferret_ext/test_test.c +83 -0
  206. data/ext/isomorfeus_ferret_ext/test_threading.c +188 -0
  207. data/ext/isomorfeus_ferret_ext/testhelper.c +561 -0
  208. data/ext/isomorfeus_ferret_ext/testhelper.h +25 -0
  209. data/ext/isomorfeus_ferret_ext/tests_all.h +87 -0
  210. data/ext/isomorfeus_ferret_ext/uchar-ucs4.rl +1854 -0
  211. data/ext/isomorfeus_ferret_ext/uchar-utf8.rl +1999 -0
  212. data/ext/isomorfeus_ferret_ext/url.rl +27 -0
  213. data/ext/isomorfeus_ferret_ext/word_list.h +15156 -0
  214. data/lib/isomorfeus/ferret/document.rb +132 -0
  215. data/lib/isomorfeus/ferret/field_symbol.rb +85 -0
  216. data/lib/isomorfeus/ferret/index/field_infos.rb +48 -0
  217. data/lib/isomorfeus/ferret/index/index.rb +970 -0
  218. data/lib/isomorfeus/ferret/monitor.rb +323 -0
  219. data/lib/isomorfeus/ferret/stdlib_patches.rb +151 -0
  220. data/lib/isomorfeus/ferret/version.rb +5 -0
  221. data/lib/isomorfeus-ferret.rb +8 -0
  222. metadata +307 -0
@@ -0,0 +1,850 @@
1
+ #include <time.h>
2
+ #include "ruby.h"
3
+ #include "frt_except.h"
4
+ #include "tests_all.h"
5
+ #include "test.h"
6
+
7
+ extern VALUE mFerret;
8
+ static VALUE mTest;
9
+
10
+ #define TST_STAT_SIZE 4
11
+ /* chars use in ticker. This is usually too fast to see */
12
+ static char status[TST_STAT_SIZE] = { '|', '/', '-', '\\' };
13
+
14
+ /* last char output to ticker */
15
+ static int curr_char;
16
+
17
+ /* The following variables control the running of the tests and can be set via
18
+ * the command line. See USAGE below.
19
+ *
20
+ * verbose: true if you want verbose messages in the error diagnostics
21
+ * show_stack: true if you want to see the stack trace on errors
22
+ * exclude: true if you want to exclude tests entered via the command line
23
+ * quiet: true if you don't want to display the ticker. This is useful if
24
+ * you are writing the error diagnostics to a file
25
+ * force: true if you want tests to run to the end. Otherwise they will
26
+ * stop once an Assertion fails.
27
+ * list_tests: true if you want to list all tests available
28
+ */
29
+ static bool verbose = false;
30
+ static bool show_stack = false;
31
+ static bool quiet = false;
32
+ static bool force = false;
33
+ static bool list_tests = false;
34
+
35
+ /* statistics */
36
+ static int t_cnt = 0;/* number of tests run */
37
+ static int a_cnt = 0;/* number of assertions */
38
+ static int f_cnt = 0;/* number of failures */
39
+
40
+ /* This is the size of the error diagnostics buffer. If you are getting too
41
+ * many errors and the end of the buffer is being reached you can set it here.
42
+ */
43
+ #define MAX_MSG_SIZE 1000000
44
+ static char *msg_buf;
45
+ static char *msg_bufp;
46
+
47
+ /* Determine if the test should be run at all */
48
+ static bool should_test_run(const char *testname)
49
+ {
50
+ if (list_tests == true) {
51
+ /* when listing tests, don't run any of them */
52
+ return false;
53
+ }
54
+ return true;
55
+ }
56
+
57
+ static void reset_stats(void) {
58
+ t_cnt = 0;
59
+ a_cnt = 0;
60
+ f_cnt = 0;
61
+ }
62
+
63
+ static void reset_status(void)
64
+ {
65
+ curr_char = 0;
66
+ }
67
+
68
+ /* Basically this just deletes the previous character and replaces it with the
69
+ * next character in the ticker array. If the tests run slowly enough it will
70
+ * look like a spinning bar. */
71
+ static void update_status(void)
72
+ {
73
+ if (!quiet) {
74
+ curr_char = (curr_char + 1) % TST_STAT_SIZE;
75
+ fprintf(stdout, "\b%c", status[curr_char]);
76
+ fflush(stdout);
77
+ }
78
+ }
79
+
80
+
81
+ /*
82
+ * Ends the test suite by writing SUCCESS or FAILED at the end of the test
83
+ * results in the diagnostics. */
84
+ static void end_suite(TestSuite *suite)
85
+ {
86
+ if (suite != NULL) {
87
+ TestSubSuite *last = suite->tail;
88
+ if (!quiet) {
89
+ fprintf(stdout, "\b");
90
+ fflush(stdout);
91
+ }
92
+ if (last->failed == 0) {
93
+ fprintf(stdout, " -> SUCCESS\n");
94
+ fflush(stdout);
95
+ }
96
+ else {
97
+ fprintf(stdout, " -> FAILED %d of %d\n", last->failed,
98
+ last->num_test);
99
+ fflush(stdout);
100
+ }
101
+ }
102
+ }
103
+
104
+ TestSuite *tst_add_suite(TestSuite *suite, const char *suite_name_full)
105
+ {
106
+ TestSubSuite *subsuite;
107
+ char *p;
108
+ const char *suite_name;
109
+ curr_char = 0;
110
+
111
+ /* Suite will be the last suite that was added to the suite list or NULL
112
+ * if this is the first call to tst_add_suite. We should only end the
113
+ * suite if we actually ran it */
114
+ if (suite && suite->tail && !suite->tail->not_run) {
115
+ end_suite(suite);
116
+ }
117
+
118
+ /* Create a new subsuite */
119
+ subsuite = (TestSubSuite *)malloc(sizeof(TestSubSuite));
120
+ subsuite->num_test = 0;
121
+ subsuite->failed = 0;
122
+ subsuite->next = NULL;
123
+
124
+ /* We may want to strip the file extension and file path from
125
+ * suite_name_full depending on __FILE__ expansion
126
+ */
127
+ suite_name = strrchr(suite_name_full, '/');
128
+ if (suite_name) {
129
+ suite_name++;
130
+ }
131
+ else {
132
+ suite_name = suite_name_full;
133
+ }
134
+ /* strip extension */
135
+ p = strrchr(suite_name, '.');
136
+ if (!p) {
137
+ p = strrchr(suite_name, '\0');
138
+ }
139
+ subsuite->name = (char *)memcpy(calloc(p - suite_name + 1, 1),
140
+ suite_name, p - suite_name);
141
+
142
+ /* If we are listing tests, just write the name of the test */
143
+ if (list_tests) {
144
+ fprintf(stdout, "%s\n", subsuite->name);
145
+ }
146
+
147
+ /* subsuite->not_run is false as we run the test by default */
148
+ subsuite->not_run = false;
149
+
150
+ if (suite == NULL) {
151
+ /* This is the first call to tst_add_suite so we need to create the
152
+ * suite */
153
+ suite = (TestSuite *)malloc(sizeof(*suite));
154
+ suite->head = subsuite;
155
+ suite->tail = subsuite;
156
+ }
157
+ else {
158
+ /* Add the current suite to the tail of the suite linked list */
159
+ suite->tail->next = subsuite;
160
+ suite->tail = subsuite;
161
+ }
162
+
163
+ if (!should_test_run(subsuite->name)) {
164
+ /* if should_test_run returned false then don't run the test */
165
+ subsuite->not_run = true;
166
+ return suite;
167
+ }
168
+
169
+ reset_status();
170
+ fprintf(stdout, " %-20s: ", subsuite->name);
171
+ update_status();
172
+ fflush(stdout);
173
+
174
+ return suite;
175
+ }
176
+
177
+ void tst_run_test_with_name(TestSuite *ts, test_func f, void *value, const char *func_name)
178
+ {
179
+ TestCase tc;
180
+ TestSubSuite *ss;
181
+
182
+ t_cnt++;
183
+
184
+ if (!should_test_run(ts->tail->name)) {
185
+ return;
186
+ }
187
+ ss = ts->tail;
188
+
189
+ tc.failed = false;
190
+ tc.suite = ss;
191
+ tc.name = func_name;
192
+
193
+ ss->num_test++;
194
+ update_status();
195
+
196
+ f(&tc, value);
197
+
198
+ if (tc.failed) {
199
+ ss->failed++;
200
+ if (quiet) {
201
+ printf("F");
202
+ }
203
+ else {
204
+ printf("\bF_");
205
+ }
206
+ }
207
+ else {
208
+ if (quiet) {
209
+ printf(".");
210
+ }
211
+ else {
212
+ printf("\b._");
213
+ }
214
+ }
215
+ update_status();
216
+ }
217
+
218
+ static int report(TestSuite *suite)
219
+ {
220
+ int count = 0;
221
+ TestSubSuite *dptr;
222
+
223
+ if (suite && suite->tail && !suite->tail->not_run) {
224
+ end_suite(suite);
225
+ }
226
+
227
+ if (list_tests) {
228
+ return 0;
229
+ }
230
+
231
+ for (dptr = suite->head; dptr; dptr = dptr->next) {
232
+ count += dptr->failed;
233
+ }
234
+
235
+
236
+ printf("\n%d tests, %d assertions, %d failures\n\n", t_cnt, a_cnt, f_cnt);
237
+ if (count == 0) {
238
+ printf("All tests passed.\n");
239
+ return 0;
240
+ }
241
+
242
+ dptr = suite->head;
243
+ fprintf(stdout, "%-24sTotal\tFail\tFailed %%\n", "Failed Tests");
244
+ fprintf(stdout, "===================================================\n");
245
+ while (dptr != NULL) {
246
+ if (dptr->failed != 0) {
247
+ double percent =
248
+ ((double) dptr->failed / (double) dptr->num_test);
249
+ fprintf(stdout, "%-24s%5d\t%4d\t%6.2f%%\n", dptr->name,
250
+ dptr->num_test, dptr->failed, percent * 100);
251
+ }
252
+ dptr = dptr->next;
253
+ }
254
+ fprintf(stdout, "===================================================\n");
255
+ msg_bufp = '\0';
256
+ fprintf(stdout, "\n%s\n", msg_buf);
257
+ return 1;
258
+ }
259
+
260
+ static const char *curr_err_func = "";
261
+
262
+ #define MSG_BUF_HAVE MAX_MSG_SIZE - (msg_bufp - msg_buf) - 1
263
+ static void vappend_to_msg_buf(const char *fmt, va_list args)
264
+ {
265
+ int v = vsnprintf(msg_bufp, MSG_BUF_HAVE, fmt, args);
266
+ if (v < 0) {
267
+ rb_raise(rb_eStandardError, "Error: can't write to test message buffer\n");
268
+ } else {
269
+ msg_bufp += v;
270
+ }
271
+ }
272
+
273
+ static void append_to_msg_buf(const char *fmt, ...)
274
+ {
275
+ va_list args;
276
+
277
+ va_start(args, fmt);
278
+ vappend_to_msg_buf(fmt, args);
279
+ va_end(args);
280
+ }
281
+
282
+
283
+ static void Tstack()
284
+ {
285
+ if (show_stack) {
286
+ char *stack = frt_get_stacktrace();
287
+ if (stack) {
288
+ append_to_msg_buf("\n\nStack trace:\n%s\n", stack);
289
+ free(stack);
290
+ }
291
+ }
292
+ }
293
+
294
+ static void vTmsg_nf(const char *fmt, va_list args)
295
+ {
296
+ if (verbose) {
297
+ vappend_to_msg_buf(fmt, args);
298
+ Tstack();
299
+ }
300
+ }
301
+
302
+ void vTmsg(const char *fmt, va_list args)
303
+ {
304
+ if (verbose) {
305
+ append_to_msg_buf("\t");
306
+ vappend_to_msg_buf(fmt, args);
307
+ va_end(args);
308
+ append_to_msg_buf("\n");
309
+
310
+ Tstack();
311
+ }
312
+ }
313
+
314
+ void Tmsg(const char *fmt, ...)
315
+ {
316
+ va_list args;
317
+
318
+ va_start(args, fmt);
319
+ vTmsg(fmt, args);
320
+ va_end(args);
321
+ }
322
+
323
+ void Tmsg_nf(const char *fmt, ...)
324
+ {
325
+ va_list args;
326
+
327
+ va_start(args, fmt);
328
+ vTmsg_nf(fmt, args);
329
+ va_end(args);
330
+ }
331
+
332
+ void tst_msg(const char *func, const char *fname, int line_num, const char *fmt, ...)
333
+ {
334
+ int i;
335
+ va_list args;
336
+
337
+ f_cnt++;
338
+
339
+ if (verbose) {
340
+ if (strcmp(curr_err_func, func) != 0) {
341
+ append_to_msg_buf("\n%s\n", func);
342
+ for (i = strlen(func) + 2; i > 0; --i)
343
+ append_to_msg_buf("=");
344
+ append_to_msg_buf("\n");
345
+ curr_err_func = func;
346
+ }
347
+ append_to_msg_buf("%3d)\n\t%s:%d\n\t", f_cnt, fname, line_num);
348
+
349
+ va_start(args, fmt);
350
+ vappend_to_msg_buf(fmt, args);
351
+ va_end(args);
352
+
353
+ Tstack();
354
+ }
355
+ }
356
+
357
+ bool tst_raise(int line_num, TestCase *tc, const int err_code,
358
+ void (*func)(void *args), void *args)
359
+ {
360
+ volatile bool was_raised = false;
361
+ a_cnt++;
362
+ update_status();
363
+ if (tc->failed && !force) {
364
+ return false;
365
+ }
366
+
367
+ FRT_TRY
368
+ func(args);
369
+ break;
370
+ default:
371
+ if (err_code == xcontext.excode) {
372
+ was_raised = true;
373
+ }
374
+ else {
375
+ tc->failed = true;
376
+ tst_msg(tc->name, tc->suite->name, line_num,
377
+ "exception %d raised unexpectedly with msg;\n\"\"\"\n%s\n\"\"\"\n",
378
+ xcontext.excode, xcontext.msg);
379
+ }
380
+ FRT_HANDLED();
381
+ FRT_XENDTRY
382
+
383
+ if (!was_raised) {
384
+ tc->failed = true;
385
+ tst_msg(tc->name, tc->suite->name, line_num,
386
+ "exception %d was not raised as expected\n",
387
+ err_code);
388
+ }
389
+ if (tc->failed) {
390
+ return false;
391
+ }
392
+ else {
393
+ return true;
394
+ }
395
+ }
396
+
397
+ #define I64_PFX POSH_I64_PRINTF_PREFIX
398
+ bool tst_int_equal(int line_num, TestCase *tc, const frt_u64 expected,
399
+ const frt_u64 actual)
400
+ {
401
+ a_cnt++;
402
+ update_status();
403
+ if (tc->failed && !force) {
404
+ return false;
405
+ }
406
+
407
+ if (expected == actual) {
408
+ return true;
409
+ }
410
+
411
+ tc->failed = true;
412
+ tst_msg(tc->name, tc->suite->name, line_num,
413
+ "expected <%"I64_PFX"d>, but saw <%"I64_PFX"d>\n",
414
+ expected, actual);
415
+ return false;
416
+ }
417
+
418
+ bool tst_flt_delta_equal(int line_num, TestCase *tc, const double expected,
419
+ const double actual, const double delta)
420
+ {
421
+ double diff;
422
+ a_cnt++;
423
+ update_status();
424
+ if (tc->failed && !force) {
425
+ return false;
426
+ }
427
+
428
+ if (expected == actual) {
429
+ return true;
430
+ }
431
+
432
+ /* account for floating point error */
433
+ diff = (expected - actual) / expected;
434
+ if ((diff * diff) < delta) {
435
+ return true;
436
+ }
437
+ fprintf(stderr, "diff = %g\n", diff);
438
+
439
+ tc->failed = true;
440
+ tst_msg(tc->name, tc->suite->name, line_num,
441
+ "expected <%G>, but saw <%G>\n", expected, actual);
442
+ return false;
443
+ }
444
+
445
+ bool tst_flt_equal(int line_num, TestCase *tc, const double expected,
446
+ const double actual)
447
+ {
448
+ return tst_flt_delta_equal(line_num, tc, expected, actual, 0.00001);
449
+ }
450
+
451
+ bool tst_str_equal(int line_num, TestCase *tc, const char *expected,
452
+ const char *actual)
453
+ {
454
+ a_cnt++;
455
+ update_status();
456
+ if (tc->failed && !force) {
457
+ return false;
458
+ }
459
+
460
+ if (expected == NULL && actual == NULL) {
461
+ return true;
462
+ }
463
+ if (expected && actual && strcmp(expected, actual) == 0) {
464
+ return true;
465
+ }
466
+
467
+ tc->failed = true;
468
+ tst_msg(tc->name, tc->suite->name, line_num,
469
+ "expected <\"%s\">, but saw <\"%s\">\n", expected, actual);
470
+ return false;
471
+ }
472
+
473
+ bool tst_strstr(int line_num, TestCase *tc, const char *haystack,
474
+ const char *needle)
475
+ {
476
+ a_cnt++;
477
+ update_status();
478
+ if (tc->failed && !force) {
479
+ return false;
480
+ }
481
+
482
+ if (needle == NULL) {
483
+ return true;
484
+ }
485
+ if (haystack && (strstr(haystack, needle) != NULL)) {
486
+ return true;
487
+ }
488
+
489
+ tc->failed = true;
490
+ tst_msg(tc->name, tc->suite->name, line_num,
491
+ "haystack <\"%s\">, doesn't contain needle <\"%s\">\n", haystack, needle);
492
+ return false;
493
+ }
494
+
495
+ bool tst_arr_int_equal(int line_num, TestCase *tc, const int *expected,
496
+ const int *actual, int size)
497
+ {
498
+ a_cnt++;
499
+ update_status();
500
+ if (tc->failed && !force) {
501
+ return false;
502
+ }
503
+
504
+ if (expected == NULL && actual == NULL) {
505
+ return true;
506
+ }
507
+ if (expected && actual) {
508
+ int i;
509
+ for (i = 0; i < size; i++) {
510
+ if (expected[i] != actual[i]) {
511
+ tc->failed = true;
512
+ tst_msg(tc->name, tc->suite->name, line_num,
513
+ "testing array element %d, expected <%d>,"
514
+ "but saw <%d>\n",
515
+ i, expected[i], actual[i]);
516
+ }
517
+ }
518
+ }
519
+ return false;
520
+ }
521
+
522
+ bool tst_arr_str_equal(int line_num, TestCase *tc, const char **expected,
523
+ const char **actual, int size)
524
+ {
525
+ a_cnt++;
526
+ update_status();
527
+ if (tc->failed && !force) {
528
+ return false;
529
+ }
530
+
531
+ if (expected == NULL && actual == NULL) {
532
+ return true;
533
+ }
534
+ if (expected && actual) {
535
+ int i;
536
+ for (i = 0; i < size; i++) {
537
+ if (strcmp(expected[i], actual[i]) != 0) {
538
+ tc->failed = true;
539
+ tst_msg(tc->name, tc->suite->name, line_num,
540
+ "testing array element %d, expected "
541
+ "<\"%s\">, but saw <\"%s\">\n",
542
+ i, expected[i], actual[i]);
543
+ }
544
+ }
545
+ }
546
+ return false;
547
+ }
548
+
549
+ bool tst_str_nequal(int line_num, TestCase *tc, const char *expected,
550
+ const char *actual, size_t n)
551
+ {
552
+ char *buf1;
553
+ char *buf2;
554
+
555
+ a_cnt++;
556
+ update_status();
557
+ if (tc->failed && !force) {
558
+ return false;
559
+ }
560
+
561
+ if (!strncmp(expected, actual, n)) {
562
+ return true;
563
+ }
564
+
565
+ tc->failed = true;
566
+
567
+ buf1 = FRT_ALLOC_N(char, n + 1);
568
+ buf2 = FRT_ALLOC_N(char, n + 1);
569
+ tst_msg(tc->name, tc->suite->name, line_num,
570
+ "expected <\"%s\">, but saw <\"%s\">.\n",
571
+ strncpy(buf1, expected, n), strncpy(buf2, actual, n));
572
+ free(buf1);
573
+ free(buf2);
574
+ return false;
575
+ }
576
+
577
+ bool tst_ptr_null(int line_num, TestCase *tc, const void *ptr)
578
+ {
579
+ a_cnt++;
580
+ update_status();
581
+ if (tc->failed && !force) {
582
+ return false;
583
+ }
584
+
585
+ if (ptr == NULL) {
586
+ return true;
587
+ }
588
+
589
+ tc->failed = true;
590
+ tst_msg(tc->name, tc->suite->name, line_num, "didn't expect <%p>\n", ptr);
591
+ return false;
592
+ }
593
+
594
+ bool tst_ptr_notnull(int line_num, TestCase *tc, const void *ptr)
595
+ {
596
+ a_cnt++;
597
+ update_status();
598
+ if (tc->failed && !force) {
599
+ return false;
600
+ }
601
+
602
+ if (ptr != NULL) {
603
+ return true;
604
+ }
605
+
606
+ tc->failed = true;
607
+ tst_msg(tc->name, tc->suite->name, line_num, "didn't expect <%p>\n", ptr);
608
+ return false;
609
+ }
610
+
611
+ bool tst_ptr_equal(int line_num, TestCase *tc, const void *expected,
612
+ const void *actual)
613
+ {
614
+ a_cnt++;
615
+ update_status();
616
+ if (tc->failed && !force) {
617
+ return false;
618
+ }
619
+
620
+ if (expected == actual) {
621
+ return true;
622
+ }
623
+
624
+ tc->failed = true;
625
+ tst_msg(tc->name, tc->suite->name, line_num,
626
+ "expected <%p>, but saw <%p>\n", expected, actual);
627
+ return false;
628
+ }
629
+
630
+ bool tst_fail(int line_num, TestCase *tc, const char *fmt, ...)
631
+ {
632
+ va_list args;
633
+ a_cnt++;
634
+ update_status();
635
+ if (tc->failed && !force) {
636
+ return false;
637
+ }
638
+
639
+ tc->failed = true;
640
+ va_start(args, fmt);
641
+ tst_msg(tc->name, tc->suite->name, line_num, fmt, args);
642
+ va_end(args);
643
+ return false;
644
+ }
645
+
646
+ bool tst_assert(int line_num, TestCase *tc, int condition, const char *fmt, ...)
647
+ {
648
+ va_list args;
649
+ a_cnt++;
650
+ update_status();
651
+ if (tc->failed && !force) {
652
+ return false;
653
+ }
654
+
655
+ if (condition) {
656
+ return true;
657
+ }
658
+
659
+ tc->failed = true;
660
+ tst_msg(tc->name, tc->suite->name, line_num, "Assertion failed\n");
661
+ va_start(args, fmt);
662
+ vTmsg(fmt, args);
663
+ va_end(args);
664
+ return false;
665
+ }
666
+
667
+ bool tst_true(int line_num, TestCase *tc, int condition)
668
+ {
669
+ a_cnt++;
670
+ update_status();
671
+ if (tc->failed && !force) {
672
+ return false;
673
+ }
674
+
675
+ if (condition) {
676
+ return true;
677
+ }
678
+
679
+ tc->failed = true;
680
+ tst_msg(tc->name, tc->suite->name, line_num,
681
+ "Condition is false, but expected true\n", tc->suite->name,
682
+ line_num);
683
+ return false;
684
+ }
685
+
686
+ bool tst_not_impl(int line_num, TestCase *tc, const char *message)
687
+ {
688
+ a_cnt++;
689
+ update_status();
690
+
691
+ tc->suite->not_impl++;
692
+ tst_msg(tc->name, tc->suite->name, line_num, "%s\n", message);
693
+ return false;
694
+ }
695
+
696
+ #ifndef FRT_HAS_VARARGS
697
+ bool Assert(int condition, const char *fmt, ...)
698
+ {
699
+ if (condition) {
700
+ return true;
701
+ }
702
+ else {
703
+ va_list args;
704
+ Tmsg("\n ?)");
705
+ Tmsg("Assertion failed");
706
+ va_start(args, fmt);
707
+ vTmsg(fmt, args);
708
+ va_end(args);
709
+ return false;
710
+ }
711
+ }
712
+ #endif
713
+
714
+ int execute_test(int test_index) {
715
+ int rv = 0;
716
+ TestSuite *suite = NULL;
717
+ TestSubSuite *subsuite;
718
+ verbose = true;
719
+ show_stack = true;
720
+ msg_buf = FRT_ALLOC_N(char, MAX_MSG_SIZE);
721
+ msg_bufp = msg_buf;
722
+
723
+ clock_t start_time = clock();
724
+ suite = all_tests[test_index].func(suite);
725
+
726
+ rv = report(suite);
727
+ printf("\nFinished in %0.3f seconds\n", (double) (clock() - start_time) / CLOCKS_PER_SEC);
728
+
729
+ while ((subsuite = suite->head) != NULL) {
730
+ suite->head = subsuite->next;
731
+ free(subsuite->name);
732
+ free(subsuite);
733
+ }
734
+ reset_stats();
735
+ free(suite);
736
+ free(msg_buf);
737
+ return rv;
738
+ }
739
+
740
+ static VALUE frb_ts_1710(VALUE v) { return INT2FIX(execute_test(0)); }
741
+ static VALUE frb_ts_analysis(VALUE v) { return INT2FIX(execute_test(1)); }
742
+ static VALUE frb_ts_array(VALUE v) { return INT2FIX(execute_test(2)); }
743
+ static VALUE frb_ts_bitvector(VALUE v) { return INT2FIX(execute_test(3)); }
744
+ static VALUE frb_ts_compound_io(VALUE v) { return INT2FIX(execute_test(4)); }
745
+ static VALUE frb_ts_document(VALUE v) { return INT2FIX(execute_test(5)); }
746
+ static VALUE frb_ts_except(VALUE v) { return INT2FIX(execute_test(6)); }
747
+ static VALUE frb_ts_fields(VALUE v) { return INT2FIX(execute_test(7)); }
748
+ static VALUE frb_ts_file_deleter(VALUE v) { return INT2FIX(execute_test(8)); }
749
+ static VALUE frb_ts_filter(VALUE v) { return INT2FIX(execute_test(9)); }
750
+ static VALUE frb_ts_fs_store(VALUE v) { return INT2FIX(execute_test(10)); }
751
+ static VALUE frb_ts_global(VALUE v) { return INT2FIX(execute_test(11)); }
752
+ static VALUE frb_ts_hash(VALUE v) { return INT2FIX(execute_test(12)); }
753
+ static VALUE frb_ts_hashset(VALUE v) { return INT2FIX(execute_test(13)); }
754
+ static VALUE frb_ts_helper(VALUE v) { return INT2FIX(execute_test(14)); }
755
+ static VALUE frb_ts_highlighter(VALUE v) { return INT2FIX(execute_test(15)); }
756
+ static VALUE frb_ts_index(VALUE v) { return INT2FIX(execute_test(16)); }
757
+ static VALUE frb_ts_lang(VALUE v) { return INT2FIX(execute_test(17)); }
758
+ static VALUE frb_ts_mem_pool(VALUE v) { return INT2FIX(execute_test(18)); }
759
+ static VALUE frb_ts_multimapper(VALUE v) { return INT2FIX(execute_test(19)); }
760
+ static VALUE frb_ts_priorityqueue(VALUE v){ return INT2FIX(execute_test(20)); }
761
+ static VALUE frb_ts_q_const_score(VALUE v){ return INT2FIX(execute_test(21)); }
762
+ static VALUE frb_ts_q_filtered(VALUE v) { return INT2FIX(execute_test(22)); }
763
+ static VALUE frb_ts_q_fuzzy(VALUE v) { return INT2FIX(execute_test(23)); }
764
+ static VALUE frb_ts_q_parser(VALUE v) { return INT2FIX(execute_test(24)); }
765
+ static VALUE frb_ts_q_span(VALUE v) { return INT2FIX(execute_test(25)); }
766
+ static VALUE frb_ts_ram_store(VALUE v) { return INT2FIX(execute_test(26)); }
767
+ static VALUE frb_ts_search(VALUE v) { return INT2FIX(execute_test(27)); }
768
+ static VALUE frb_ts_multi_search(VALUE v) { return INT2FIX(execute_test(28)); }
769
+ static VALUE frb_ts_segments(VALUE v) { return INT2FIX(execute_test(29)); }
770
+ static VALUE frb_ts_similarity(VALUE v) { return INT2FIX(execute_test(30)); }
771
+ static VALUE frb_ts_sort(VALUE v) { return INT2FIX(execute_test(31)); }
772
+ static VALUE frb_ts_term(VALUE v) { return INT2FIX(execute_test(32)); }
773
+ static VALUE frb_ts_term_vectors(VALUE v) { return INT2FIX(execute_test(33)); }
774
+ static VALUE frb_ts_test(VALUE v) { return INT2FIX(execute_test(34)); }
775
+ static VALUE frb_ts_threading(VALUE v) { return INT2FIX(execute_test(35)); }
776
+
777
+ static VALUE frb_ts_run_all(VALUE v) {
778
+ int i, test_count;
779
+ int rv = 0;
780
+ TestSuite *suite = NULL;
781
+ TestSubSuite *subsuite;
782
+ verbose = true;
783
+ show_stack = true;
784
+ force = true;
785
+ test_count = (int)FRT_NELEMS(all_tests);
786
+ msg_buf = FRT_ALLOC_N(char, MAX_MSG_SIZE);
787
+ msg_bufp = msg_buf;
788
+
789
+ clock_t start_time = clock();
790
+ for (i = 0; i < test_count; i++) {
791
+ suite = all_tests[i].func(suite);
792
+ }
793
+
794
+ /* print out the test diagnotics */
795
+ rv = report(suite);
796
+ printf("\nFinished in %0.3f seconds\n", (double) (clock() - start_time) / CLOCKS_PER_SEC);
797
+
798
+ /* free allocated test suites */
799
+ while ((subsuite = suite->head) != NULL) {
800
+ suite->head = subsuite->next;
801
+ free(subsuite->name);
802
+ free(subsuite);
803
+ }
804
+ reset_stats();
805
+ free(suite);
806
+ free(msg_buf);
807
+ return INT2FIX(rv);
808
+ }
809
+
810
+ void Init_Test(void) {
811
+ mTest = rb_define_module_under(mFerret, "Test");
812
+ rb_define_singleton_method(mTest, "ts_1710", frb_ts_1710, 0);
813
+ rb_define_singleton_method(mTest, "analysis", frb_ts_analysis, 0);
814
+ rb_define_singleton_method(mTest, "array", frb_ts_array, 0);
815
+ rb_define_singleton_method(mTest, "bitvector", frb_ts_bitvector, 0);
816
+ rb_define_singleton_method(mTest, "compound_io", frb_ts_compound_io, 0);
817
+ rb_define_singleton_method(mTest, "document", frb_ts_document, 0);
818
+ rb_define_singleton_method(mTest, "except", frb_ts_except, 0);
819
+ rb_define_singleton_method(mTest, "fields", frb_ts_fields, 0);
820
+ rb_define_singleton_method(mTest, "file_deleter", frb_ts_file_deleter, 0);
821
+ rb_define_singleton_method(mTest, "filter", frb_ts_filter, 0);
822
+ rb_define_singleton_method(mTest, "fs_store", frb_ts_fs_store, 0);
823
+ rb_define_singleton_method(mTest, "global", frb_ts_global, 0);
824
+ rb_define_singleton_method(mTest, "hash", frb_ts_hash, 0);
825
+ rb_define_singleton_method(mTest, "hashset", frb_ts_hashset, 0);
826
+ rb_define_singleton_method(mTest, "helper", frb_ts_helper, 0);
827
+ rb_define_singleton_method(mTest, "highlighter", frb_ts_highlighter, 0);
828
+ rb_define_singleton_method(mTest, "index", frb_ts_index, 0);
829
+ rb_define_singleton_method(mTest, "lang", frb_ts_lang, 0);
830
+ rb_define_singleton_method(mTest, "mem_pool", frb_ts_mem_pool, 0);
831
+ rb_define_singleton_method(mTest, "multimapper", frb_ts_multimapper, 0);
832
+ rb_define_singleton_method(mTest, "priorityqueue", frb_ts_priorityqueue, 0);
833
+ rb_define_singleton_method(mTest, "q_const_score", frb_ts_q_const_score, 0);
834
+ rb_define_singleton_method(mTest, "q_filtered", frb_ts_q_filtered, 0);
835
+ rb_define_singleton_method(mTest, "q_fuzzy", frb_ts_q_fuzzy, 0);
836
+ rb_define_singleton_method(mTest, "q_parser", frb_ts_q_parser, 0);
837
+ rb_define_singleton_method(mTest, "q_span", frb_ts_q_span, 0);
838
+ rb_define_singleton_method(mTest, "ram_store", frb_ts_ram_store, 0);
839
+ rb_define_singleton_method(mTest, "search", frb_ts_search, 0);
840
+ rb_define_singleton_method(mTest, "multi_search", frb_ts_multi_search, 0);
841
+ rb_define_singleton_method(mTest, "segments", frb_ts_segments, 0);
842
+ rb_define_singleton_method(mTest, "similarity", frb_ts_similarity, 0);
843
+ rb_define_singleton_method(mTest, "sort", frb_ts_sort, 0);
844
+ rb_define_singleton_method(mTest, "term", frb_ts_term, 0);
845
+ rb_define_singleton_method(mTest, "term_vectors", frb_ts_term_vectors, 0);
846
+ rb_define_singleton_method(mTest, "test", frb_ts_test, 0);
847
+ rb_define_singleton_method(mTest, "threading", frb_ts_threading, 0);
848
+
849
+ rb_define_singleton_method(mTest, "run_all", frb_ts_run_all, 0);
850
+ }