package ch.ethz.globis.distindex.mapping.bst;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class LongArrayKeyConverterTest {

    @Test
    public void testConversion() {
        KeyConverter<long[]> keyConverter = new LongArrayKeyConverter();
        String keyString = keyConverter.convert(new long[] { -1L, 0L});
        String expected = "";
        for (int i = 0; i < 64; i++) {
            expected += "10";
        }
        assertEquals(expected, keyString);

        keyString = keyConverter.convert(new long[] { 0L, -1L, 0L});
        expected = "";
        for (int i = 0; i < 64; i++) {
            expected += "010";
        }
        assertEquals(expected, keyString);
    }
}

@@ -495,16 +495,649 @@
 ring);%0A%0A
+        keyString = keyConverter.convert(new long%5B%5D %7B 0L, 0L%7D);%0A        expected = %22%22;%0A        for (int i = 0; i %3C 64; i++) %7B%0A            expected += %2200%22;%0A        %7D%0A        assertEquals(expected, keyString);%0A%0A        keyString = keyConverter.convert(new long%5B%5D %7B 0L, -1L%7D);%0A        expected = %22%22;%0A        for (int i = 0; i %3C 64; i++) %7B%0A            expected += %2201%22;%0A        %7D%0A        assertEquals(expected, keyString);%0A%0A        keyString = keyConverter.convert(new long%5B%5D %7B -1L, -1L%7D);%0A        expected = %22%22;%0A        for (int i = 0; i %3C 64; i++) %7B%0A            expected += %2211%22;%0A        %7D%0A        assertEquals(expected, keyString);%0A%0A
         

Index distribution Added more test cases for the converter.