// 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 randomSizeForChar() {
//     return requireValidSizeChar(current().nextInt(1, Character.SIZE));
// }
// 
// 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 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 org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import java.io.IOException;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForByte;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForChar;
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.concurrent.ThreadLocalRandom.current;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.lenient;
        } else {
            if (value >= 0) {
                assertEquals(0, value >> (size - 1));
            } else {
                assertEquals(-1, value >> (size - 1));
            }
        }
    }

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

    // ------------------------------------------------------------------------------------------------------------- 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 randomSizeForChar() {
//     return requireValidSizeChar(current().nextInt(1, Character.SIZE));
// }
// 
// 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/AbstractBitInputSpyTest.java
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 org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Spy;
import org.mockito.junit.jupiter.MockitoExtension;
import java.io.IOException;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForByte;
import static com.github.jinahya.bit.io.BitIoTests.randomSizeForChar;
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.concurrent.ThreadLocalRandom.current;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.lenient;

        } else {
            if (value >= 0) {
                assertEquals(0, value >> (size - 1));
            } else {
                assertEquals(-1, value >> (size - 1));
            }
        }
    }

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

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