CavalliumDBEngine/src/test/java/it/cavallium/dbengine/TestAlignedRead.java

23 lines
826 B
Java
Raw Normal View History

2021-07-01 21:19:52 +02:00
package it.cavallium.dbengine;
import it.cavallium.dbengine.lucene.DirectNIOFSDirectory;
import it.cavallium.dbengine.lucene.LuceneUtils;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.file.Files;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class TestAlignedRead {
@Test
public void testAlignment() {
Assertions.assertEquals(0, LuceneUtils.alignUnsigned(0, true));
Assertions.assertEquals(0, LuceneUtils.alignUnsigned(0, false));
Assertions.assertEquals(4096, LuceneUtils.alignUnsigned(1, true));
Assertions.assertEquals(0, LuceneUtils.alignUnsigned(1, false));
Assertions.assertEquals(4096, LuceneUtils.alignUnsigned(4096, true));
Assertions.assertEquals(4096, LuceneUtils.alignUnsigned(4096, false));
}
}