// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForByte(final boolean unsigned) {
//     return requireValidSizeByte(unsigned, current().nextInt(1, Byte.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForInt(final boolean unsigned) {
//     return requireValidSizeInt(unsigned, current().nextInt(1, Integer.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForLong(final boolean unsigned) {
//     return requireValidSizeLong(unsigned, current().nextInt(1, Long.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForShort(final boolean unsigned) {
//     return requireValidSizeShort(unsigned, current().nextInt(1, Short.SIZE + (unsigned ? 0 : 1)));
// }


import static com.github.jinahya.bit.io.BitIoTests.randomSizeForByte;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForInt;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForLong;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForShort;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.ThreadLocalRandom.current;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import java.io.IOException;
    /**
     * Asserts {@link BitInput#readByte(boolean, int)} throws an {@link IllegalArgumentException} when {@code size} is
     * less than {@code 1}.
     */
    @Test
    void assertReadByteThrowsIllegalArgumentExceptionWhenSizeIsLessThanOne() {
        assertThrows(IllegalArgumentException.class, () -> bitInput.readByte(current().nextBoolean(), 0));
        assertThrows(IllegalArgumentException.class,
                     () -> bitInput.readByte(current().nextBoolean(), current().nextInt() | Integer.MIN_VALUE));
    }

    @RepeatedTest(8)
    void testReadByte() throws IOException {
        final boolean unsigned = current().nextBoolean();
        final int size = randomSizeForByte(unsigned);
        final byte value = bitInput.readByte(unsigned, size);
    }

    // ----------------------------------------------------------------------------------------------------------- short
    @RepeatedTest(8)
    void testReadShort() throws IOException {
        final boolean unsigned = current().nextBoolean();
        final int size = randomSizeForShort(unsigned);
        final short value = bitInput.readShort(unsigned, size);
    }

    // ------------------------------------------------------------------------------------------------------------- int
    @RepeatedTest(8)
    void testReadInt() throws IOException {
        final boolean unsigned = current().nextBoolean();
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForByte(final boolean unsigned) {
//     return requireValidSizeByte(unsigned, current().nextInt(1, Byte.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForInt(final boolean unsigned) {
//     return requireValidSizeInt(unsigned, current().nextInt(1, Integer.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForLong(final boolean unsigned) {
//     return requireValidSizeLong(unsigned, current().nextInt(1, Long.SIZE + (unsigned ? 0 : 1)));
// }
// 
// Path: src/test/java/com/github/jinahya/bit/io/BitIoTests.java
// static int randomSizeForShort(final boolean unsigned) {
//     return requireValidSizeShort(unsigned, current().nextInt(1, Short.SIZE + (unsigned ? 0 : 1)));
// }


// Path: src/test/java/com/github/jinahya/bit/io/BitInputTest.java
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForByte;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForInt;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForLong;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForShort;
import static java.util.Objects.requireNonNull;
import static java.util.concurrent.ThreadLocalRandom.current;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.RepeatedTest;
import org.junit.jupiter.api.Test;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import java.io.IOException;

    /**
     * Asserts {@link BitInput#readByte(boolean, int)} throws an {@link IllegalArgumentException} when {@code size} is
     * less than {@code 1}.
     */
    @Test
    void assertReadByteThrowsIllegalArgumentExceptionWhenSizeIsLessThanOne() {
        assertThrows(IllegalArgumentException.class, () -> bitInput.readByte(current().nextBoolean(), 0));
        assertThrows(IllegalArgumentException.class,
                     () -> bitInput.readByte(current().nextBoolean(), current().nextInt() | Integer.MIN_VALUE));
    }

    @RepeatedTest(8)
    void testReadByte() throws IOException {
        final boolean unsigned = current().nextBoolean();
        final int size = randomSizeForByte(unsigned);
        final byte value = bitInput.readByte(unsigned, size);
    }

    // ----------------------------------------------------------------------------------------------------------- short
    @RepeatedTest(8)
    void testReadShort() throws IOException {
        final boolean unsigned = current().nextBoolean();
        final int size = randomSizeForShort(unsigned);
        final short value = bitInput.readShort(unsigned, size);
    }

    // ------------------------------------------------------------------------------------------------------------- int
    @RepeatedTest(8)
    void testReadInt() throws IOException {
        final boolean unsigned = current().nextBoolean();
        final int size = randomSizeForInt(unsigned);