You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by lo...@apache.org on 2012/03/29 20:24:37 UTC

[lucy-commits] svn commit: r1307030 - in /lucy/trunk: core/Lucy/Test/Search/TestSpan.c core/Lucy/Test/Search/TestSpan.cfh perl/MANIFEST perl/buildlib/Lucy/Build/Binding/Misc.pm perl/t/309-span.t perl/t/core/309-span.t

Author: logie
Date: Thu Mar 29 18:24:37 2012
New Revision: 1307030

URL: http://svn.apache.org/viewvc?rev=1307030&view=rev
Log:
LUCY-222
Porting of 309-span.t to C.

Added:
    lucy/trunk/core/Lucy/Test/Search/TestSpan.c
    lucy/trunk/core/Lucy/Test/Search/TestSpan.cfh
    lucy/trunk/perl/t/core/309-span.t
Removed:
    lucy/trunk/perl/t/309-span.t
Modified:
    lucy/trunk/perl/MANIFEST
    lucy/trunk/perl/buildlib/Lucy/Build/Binding/Misc.pm

Added: lucy/trunk/core/Lucy/Test/Search/TestSpan.c
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Test/Search/TestSpan.c?rev=1307030&view=auto
==============================================================================
--- lucy/trunk/core/Lucy/Test/Search/TestSpan.c (added)
+++ lucy/trunk/core/Lucy/Test/Search/TestSpan.c Thu Mar 29 18:24:37 2012
@@ -0,0 +1,49 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define C_LUCY_TESTTERMINFO
+#include "Lucy/Util/ToolSet.h"
+
+#include "Lucy/Test.h"
+#include "Lucy/Test/Search/TestSpan.h"
+#include "Lucy/Search/Span.h"
+
+void 
+test_span_init_values(TestBatch *batch) {
+    Span* span = Span_new(2,3,7);
+    TEST_INT_EQ(batch, Span_Get_Offset(span), 2, "get_offset" );
+    TEST_INT_EQ(batch, Span_Get_Length(span), 3, "get_length" );
+    TEST_INT_EQ(batch, Span_Get_Weight(span), 7, "get_weight" );
+
+    Span_Set_Offset(span, 10);
+    Span_Set_Length(span, 1);
+    Span_Set_Weight(span, 4);
+
+    TEST_INT_EQ(batch, Span_Get_Offset(span), 10, "set_offset" );
+    TEST_INT_EQ(batch, Span_Get_Length(span), 1, "set_length" );
+    TEST_INT_EQ(batch, Span_Get_Weight(span), 4, "set_weight" );
+
+    DECREF(span);
+}
+
+void
+TestSpan_run_tests() {
+    TestBatch *batch = TestBatch_new(6);
+    TestBatch_Plan(batch);
+    test_span_init_values(batch);
+
+    DECREF(batch);
+}

Added: lucy/trunk/core/Lucy/Test/Search/TestSpan.cfh
URL: http://svn.apache.org/viewvc/lucy/trunk/core/Lucy/Test/Search/TestSpan.cfh?rev=1307030&view=auto
==============================================================================
--- lucy/trunk/core/Lucy/Test/Search/TestSpan.cfh (added)
+++ lucy/trunk/core/Lucy/Test/Search/TestSpan.cfh Thu Mar 29 18:24:37 2012
@@ -0,0 +1,24 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel Lucy;
+
+inert class Lucy::Test::Search::TestSpan {
+    inert void
+    run_tests();
+}
+
+

Modified: lucy/trunk/perl/MANIFEST
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/MANIFEST?rev=1307030&r1=1307029&r2=1307030&view=diff
==============================================================================
--- lucy/trunk/perl/MANIFEST (original)
+++ lucy/trunk/perl/MANIFEST Thu Mar 29 18:24:37 2012
@@ -268,7 +268,6 @@ t/304-verify_utf8.t
 t/305-indexer.t
 t/306-dynamic_schema.t
 t/308-simple.t
-t/309-span.t
 t/310-heat_map.t
 t/311-hl_selection.t
 t/400-match_posting.t
@@ -390,6 +389,7 @@ t/core/232-numeric_type.t
 t/core/234-field_type.t
 t/core/301-segment.t
 t/core/303-highlighter.t
+t/core/309-span.t
 t/core/501-termquery.t
 t/core/502-phrasequery.t
 t/core/515-range_query.t

Modified: lucy/trunk/perl/buildlib/Lucy/Build/Binding/Misc.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Misc.pm?rev=1307030&r1=1307029&r2=1307030&view=diff
==============================================================================
--- lucy/trunk/perl/buildlib/Lucy/Build/Binding/Misc.pm (original)
+++ lucy/trunk/perl/buildlib/Lucy/Build/Binding/Misc.pm Thu Mar 29 18:24:37 2012
@@ -198,6 +198,9 @@ PPCODE:
     else if (strEQ(package, "TestSeriesMatcher")) {
         lucy_TestSeriesMatcher_run_tests();
     }
+    else if (strEQ(package, "TestSpan")) {
+        lucy_TestSpan_run_tests();
+    }
     else if (strEQ(package, "TestRangeQuery")) {
         lucy_TestRangeQuery_run_tests();
     }

Added: lucy/trunk/perl/t/core/309-span.t
URL: http://svn.apache.org/viewvc/lucy/trunk/perl/t/core/309-span.t?rev=1307030&view=auto
==============================================================================
--- lucy/trunk/perl/t/core/309-span.t (added)
+++ lucy/trunk/perl/t/core/309-span.t Thu Mar 29 18:24:37 2012
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use strict;
+use warnings;
+
+use Lucy::Test;
+Lucy::Test::run_tests("TestSpan");
+