package enc;

import static java.lang.System.out;

import java.io.IOException;

import org.apache.parquet.column.values.rle.RunLengthBitPackingHybridEncoder;

public class GenerateRLETestCases {
    private static void printLine() {
        out.println("===============================================\n");
    }

    private static void printBytes(byte[] bytes) {
        for (byte b : bytes) {
            out.printf("0x%02X ", b);
        }
        out.println();
    }

    private static void genSingleRLERun_10_Zeroes_1_bit() throws IOException {
        out.println("Single RLE run: 1-bit per value, 10x0");
        RunLengthBitPackingHybridEncoder e = new RunLengthBitPackingHybridEncoder(
                1, 10, 10000);
        for (int i = 0; i < 10; i++) {
            e.writeInt(0);
        }
        printBytes(e.toBytes().toByteArray());
        printLine();
    }

    private static void genSingleRLERun_300_Ones_20_bit() throws IOException {
        out.println("Single RLE run: 20-bits per value, 300x1");
        RunLengthBitPackingHybridEncoder e = new RunLengthBitPackingHybridEncoder(
                20, 10, 10000);
        for (int i = 0; i < 300; i++) {
            e.writeInt(1);
        }
        printBytes(e.toBytes().toByteArray());
        printLine();
    }

    public static void main(String[] args) throws IOException {
        genSingleRLERun_10_Zeroes_1_bit();
        genSingleRLERun_300_Ones_20_bit();
    }
}

@@ -1280,24 +1280,509 @@
 e();%0A    %7D%0A%0A
+    private static void gen2RLERuns_10_Zeroes_9_Ones_1_bit() throws IOException %7B%0A        out.println(%222 RLE runs: 1-bit per value, 10x0, 9x1%22);%0A        RunLengthBitPackingHybridEncoder e = new RunLengthBitPackingHybridEncoder(%0A                1, 10, 10000);%0A        for (int i = 0; i %3C 10; i++) %7B%0A            e.writeInt(0);%0A        %7D%0A        for (int i = 0; i %3C 9; i++) %7B%0A            e.writeInt(1);%0A        %7D%0A        printBytes(e.toBytes().toByteArray());%0A        printLine();%0A    %7D%0A%0A
     public s
@@ -1915,20 +1915,66 @@
 s_20_bit();%0A
+        gen2RLERuns_10_Zeroes_9_Ones_1_bit();%0A
     %7D%0A%7D%0A

add generator for one more RLE test case