1 package org.apache.lucene.facet.search;
5 import org.apache.lucene.util.LuceneTestCase;
6 import org.apache.lucene.facet.search.FacetArrays;
7 import org.apache.lucene.facet.search.FloatArrayAllocator;
8 import org.apache.lucene.facet.search.IntArrayAllocator;
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed with
13 * this work for additional information regarding copyright ownership.
14 * The ASF licenses this file to You under the Apache License, Version 2.0
15 * (the "License"); you may not use this file except in compliance with
16 * the License. You may obtain a copy of the License at
18 * http://www.apache.org/licenses/LICENSE-2.0
20 * Unless required by applicable law or agreed to in writing, software
21 * distributed under the License is distributed on an "AS IS" BASIS,
22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 * See the License for the specific language governing permissions and
24 * limitations under the License.
27 public class TestFacetArrays extends LuceneTestCase {
30 public void testSimple() {
31 FacetArrays arrays = new FacetArrays(new IntArrayAllocator(1, 1), new FloatArrayAllocator(1, 1));
33 int[] intArray = arrays.getIntArray();
34 // Set the element, then free
38 // We should expect a cleared array back
39 intArray = arrays.getIntArray();
40 assertEquals("Expected a cleared array back, but the array is still filled", 0, intArray[0]);
42 float[] floatArray = arrays.getFloatArray();
43 // Set the element, then free
47 // We should expect a cleared array back
48 floatArray = arrays.getFloatArray();
49 assertEquals("Expected a cleared array back, but the array is still filled", 0.0f, floatArray[0], 0.0);