Home / Function/ testSize2Varint() — netty Function Reference

testSize2Varint() — netty Function Reference

Architecture documentation for the testSize2Varint() function in ProtobufVarint32LengthFieldPrependerTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  46b87780_dbdb_8b9c_b7e2_9d5c5b4c63ac["testSize2Varint()"]
  6eaee290_afed_8a50_d035_25ef3cea2e1f["ProtobufVarint32LengthFieldPrependerTest"]
  46b87780_dbdb_8b9c_b7e2_9d5c5b4c63ac -->|defined in| 6eaee290_afed_8a50_d035_25ef3cea2e1f
  style 46b87780_dbdb_8b9c_b7e2_9d5c5b4c63ac fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

codec-protobuf/src/test/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java lines 60–93

    @Test
    public void testSize2Varint() {
        final int size = 2;
        final int num = 266;
        assertEquals(size, ProtobufVarint32LengthFieldPrepender.computeRawVarint32Size(num));
        final byte[] buf = new byte[size + num];
        /**
         * 8    A    0    2
         * 1000 1010 0000 0010
         * 0000 1010 0000 0010
         * 0000 0010 0000 1010
         *  000 0010  000 1010
         *
         *  0000 0001 0000 1010
         *  0    1    0    A
         * 266
         */

        buf[0] = (byte) (0x8A & 0xFF);
        buf[1] = 0x02;
        for (int i = size; i < num + size; ++i) {
            buf[i] = 1;
        }
        assertTrue(ch.writeOutbound(wrappedBuffer(buf, size, buf.length - size)));

        ByteBuf expected = wrappedBuffer(buf);
        ByteBuf actual = ch.readOutbound();

        assertEquals(actual, expected);
        assertFalse(ch.finish());

        expected.release();
        actual.release();
    }

Domain

Subdomains

Frequently Asked Questions

What does testSize2Varint() do?
testSize2Varint() is a function in the netty codebase, defined in codec-protobuf/src/test/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java.
Where is testSize2Varint() defined?
testSize2Varint() is defined in codec-protobuf/src/test/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrependerTest.java at line 60.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free