Add more tests for BitShuffle

This commit is contained in:
Takeshi YAMAMURO 2016-03-31 13:04:15 +09:00
parent 695af1b189
commit f89a30c741
1 changed files with 22 additions and 1 deletions

View File

@ -29,7 +29,8 @@ import static org.junit.Assert.*;
import org.junit.Test;
public class BitShuffleTest {
@Test
@Test
public void bitShuffleLongArray()
throws Exception
{
@ -58,4 +59,24 @@ public class BitShuffleTest {
int[] result = BitShuffle.bitUnShuffleIntArray(shuffledData);
assertArrayEquals(data, result);
}
@Test
public void bitShuffleFloatArray()
throws Exception
{
float[] data = new float[] {100.0f, 0.5f, -0.1f, 30.3f, Float.MIN_NORMAL, Float.MAX_EXPONENT, Float.MAX_VALUE, -0.1f, Integer.MIN_VALUE};
byte[] shuffledData = BitShuffle.bitShuffle(data);
float[] result = BitShuffle.bitUnShuffleFloatArray(shuffledData);
assertArrayEquals(data, result, 0.0000001f);
}
@Test
public void bitShuffleDoubleArray()
throws Exception
{
double[] data = new double[] {100.0f, 0.5f, -0.1f, 30.3f, Float.MIN_NORMAL, Float.MAX_EXPONENT, Float.MAX_VALUE, -0.1f, Integer.MIN_VALUE};
byte[] shuffledData = BitShuffle.bitShuffle(data);
double[] result = BitShuffle.bitUnShuffleDoubleArray(shuffledData);
assertArrayEquals(data, result, 0.0000001f);
}
}