Author: rooneg
Date: Wed Mar 2 19:28:23 2005
New Revision: 156004
URL: http://svn.apache.org/viewcvs?view=rev&rev=156004
Log:
One more unoptimized index test.
* test/index/index_test.c
(test_index_get_document_unopt): new test, retrieves a document from a
segment other than the first.
(test_index): run new test.
Modified:
incubator/lucene4c/trunk/test/index/index_test.c
Modified: incubator/lucene4c/trunk/test/index/index_test.c
URL:
http://svn.apache.org/viewcvs/incubator/lucene4c/trunk/test/index/index_test.c?view=diff&r1=156003&r2=156004
==============================================================================
--- incubator/lucene4c/trunk/test/index/index_test.c (original)
+++ incubator/lucene4c/trunk/test/index/index_test.c Wed Mar 2 19:28:23 2005
@@ -209,6 +209,48 @@
apr_pool_clear (p);
}
+static const char *unoptpath= "src/java/org/apache/lucene/search/spans/"
+ ".svn/prop-base/package.html.svn-base";
+
+static void
+test_index_get_document_unopt (abts_case *tc, void *data)
+{
+ const lcn_char_t bogusfieldname[] = { 'a', 's', 'd', 'f', 0 };
+ const lcn_char_t fieldnamepath[] = { 'p', 'a', 't', 'h', 0 };
+ const lcn_field_t *f;
+ lcn_document_t *doc;
+ lcn_index_t *idx;
+
+ CHK_ERR (lcn_index_open (&idx, "test/data/index-unopt", p));
+
+ /* note, this document comes from the second segment in the index */
+ CHK_ERR (lcn_index_get_document (&doc, idx, 1001, p));
+
+ f = lcn_document_field_by_num (doc, 0);
+
+ ABTS_PTR_NOTNULL (tc, f);
+
+ ABTS_TRUE (tc, lcn_strcmp (lcn_field_content (f),
+ lcn_str_from_cstring (unoptpath, p)) == 0);
+
+ f = lcn_document_field_by_name (doc, fieldnamepath);
+
+ ABTS_PTR_NOTNULL (tc, f);
+
+ ABTS_TRUE (tc, lcn_strcmp (lcn_field_content (f),
+ lcn_str_from_cstring (unoptpath, p)) == 0);
+
+ f = lcn_document_field_by_num (doc, 2);
+
+ ABTS_PTR_EQUAL (tc, f, NULL);
+
+ f = lcn_document_field_by_name (doc, bogusfieldname);
+
+ ABTS_PTR_EQUAL (tc, f, NULL);
+
+ apr_pool_clear (p);
+}
+
abts_suite *
test_index (abts_suite *suite)
{
@@ -220,6 +262,7 @@
abts_run_test (suite, test_index_term_docs_cfs, NULL);
abts_run_test (suite, test_index_term_docs_unopt, NULL);
abts_run_test (suite, test_index_get_document, NULL);
+ abts_run_test (suite, test_index_get_document_unopt, NULL);
return suite;
}