···66import org.junit.jupiter.params.ParameterizedTest;
77import org.junit.jupiter.params.provider.CsvSource;
8899+import java.util.Random;
1010+911public class BufferTests {
10121113 @ParameterizedTest(name = "Buffer allocate")
···2224 Assertions.assertEquals(expectedBufferSize, buffer.buffer.length,
2325 () -> "buffer length should be " + expectedBufferSize + " with sizeMode: " + sizeMode);
24262727+ }
2828+2929+ @Test
3030+ @DisplayName("Byte test")
3131+ void byteTest() {
3232+ Buffer buffer = Buffer.allocate(0);
3333+ Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0");
3434+ Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty");
3535+3636+ Random random = new Random();
3737+ int input = random.nextInt((55 - 2) + 1) + 2;
3838+ buffer.putByte(input);
3939+ Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0");
4040+ buffer.currentPosition = 0;
4141+ Assertions.assertEquals(input, buffer.getByte(), "getByte should be the same as putByte");
4242+ }
4343+4444+4545+ @Test
4646+ @DisplayName("ShortBE test")
4747+ void smallTest() {
4848+ Buffer buffer = Buffer.allocate(0);
4949+ Assertions.assertEquals(0, buffer.currentPosition, "buffer position should be 0");
5050+ Assertions.assertArrayEquals(buffer.buffer, new byte[100], "Buffer should be completely empty");
5151+5252+ Random random = new Random();
5353+ int input = random.nextInt((55 - 2) + 1) + 2;
5454+ buffer.putShortBE(input);
5555+ Assertions.assertNotEquals(0, buffer.currentPosition, "buffer position should not be 0");
5656+ buffer.currentPosition = 0;
5757+ Assertions.assertEquals(input, buffer.getShortBE(), "getShortBE should be the same as putShortBE");
2558 }
26592760