public class TestFacetArrays extends LuceneTestCase {
@Test
public void testSimple() {
FacetArrays arrays = new FacetArrays(new IntArrayAllocator(1, 1), new FloatArrayAllocator(1, 1));
int[] intArray = arrays.getIntArray();
// Set the element, then free
intArray[0] = 1;
arrays.free();
// We should expect a cleared array back
intArray = arrays.getIntArray();
assertEquals("Expected a cleared array back, but the array is still filled", 0, intArray[0]);
float[] floatArray = arrays.getFloatArray();
// Set the element, then free
floatArray[0] = 1.0f;
arrays.free();
// We should expect a cleared array back
floatArray = arrays.getFloatArray();
assertEquals("Expected a cleared array back, but the array is still filled", 0.0f, floatArray[0], 0.0);
}