Classes | Public Member Functions | Static Private Member Functions | List of all members
com.google.protobuf.CodedOutputStreamTest Class Reference
Inheritance diagram for com.google.protobuf.CodedOutputStreamTest:
Inheritance graph
[legend]

Classes

class  ArrayCoder
 
interface  Coder
 
class  NioDirectCoder
 
class  NioHeapCoder
 
class  OutputStreamCoder
 
enum  OutputType
 

Public Member Functions

void testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace () throws Exception
 
void testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace () throws Exception
 
void testDifferentStringLengths () throws Exception
 
void testDifferentStringLengths () throws Exception
 
void testEncodeZigZag () throws Exception
 
void testEncodeZigZag () throws Exception
 
void testGetTotalBytesWritten () throws Exception
 
void testGetTotalBytesWritten () throws Exception
 
void testNioEncodersWithInitialOffsets () throws Exception
 
void testNioEncodersWithInitialOffsets () throws Exception
 
void testSerializeInvalidUtf8 () throws Exception
 
void testSerializeInvalidUtf8 () throws Exception
 
void testSerializeInvalidUtf8FollowedByOutOfSpace () throws Exception
 
void testSerializeInvalidUtf8FollowedByOutOfSpace () throws Exception
 
void testSerializeUtf8_MultipleSmallWrites () throws Exception
 
void testSerializeUtf8_MultipleSmallWrites () throws Exception
 
void testVarintRoundTrips () throws Exception
 
void testVarintRoundTrips () throws Exception
 
void testWriteByteArrayWithOffsets () throws Exception
 
void testWriteByteArrayWithOffsets () throws Exception
 
void testWriteByteBuffer () throws Exception
 
void testWriteByteBuffer () throws Exception
 
void testWriteLittleEndian () throws Exception
 
void testWriteLittleEndian () throws Exception
 
void testWriteMessageWithNegativeEnumValue () throws Exception
 
void testWriteMessageWithNegativeEnumValue () throws Exception
 
void testWriteStringNoTag_fastpath () throws Exception
 
void testWriteStringNoTag_fastpath () throws Exception
 
void testWriteToByteBuffer () throws Exception
 
void testWriteToByteBuffer () throws Exception
 
void testWriteVarint () throws Exception
 
void testWriteVarint () throws Exception
 
void testWriteWholeMessage () throws Exception
 
void testWriteWholeMessage () throws Exception
 
void testWriteWholePackedFieldsMessage () throws Exception
 
void testWriteWholePackedFieldsMessage () throws Exception
 

Static Private Member Functions

static void assertEqualBytes (OutputType outputType, byte[] a, byte[] b)
 
static void assertEqualBytes (OutputType outputType, byte[] a, byte[] b)
 
static void assertVarintRoundTrip (OutputType outputType, long value) throws Exception
 
static void assertVarintRoundTrip (OutputType outputType, long value) throws Exception
 
static void assertWriteLittleEndian32 (byte[] data, int value) throws Exception
 
static void assertWriteLittleEndian32 (byte[] data, int value) throws Exception
 
static void assertWriteLittleEndian64 (byte[] data, long value) throws Exception
 
static void assertWriteLittleEndian64 (byte[] data, long value) throws Exception
 
static void assertWriteVarint (byte[] data, long value) throws Exception
 
static void assertWriteVarint (byte[] data, long value) throws Exception
 
static byte[] bytes (int... bytesAsInts)
 
static byte[] bytes (int... bytesAsInts)
 
static String fullString (char c, int length)
 
static String fullString (char c, int length)
 
static String newString (char... chars)
 
static String newString (char... chars)
 
static void testEncodingOfString (OutputType outputType, char c, int length) throws Exception
 
static void testEncodingOfString (OutputType outputType, char c, int length) throws Exception
 
static List< BytetoList (byte[] bytes)
 
static List< BytetoList (byte[] bytes)
 

Detailed Description

Unit test for CodedOutputStream.

Author
kento.nosp@m.n@go.nosp@m.ogle..nosp@m.com Kenton Varda

Unit test for CodedOutputStream.

Definition at line 51 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

Member Function Documentation

◆ assertEqualBytes() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.assertEqualBytes ( OutputType  outputType,
byte[]  a,
byte[]  b 
)
inlinestaticprivate

◆ assertEqualBytes() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.assertEqualBytes ( OutputType  outputType,
byte[]  a,
byte[]  b 
)
inlinestaticprivate

◆ assertVarintRoundTrip() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.assertVarintRoundTrip ( OutputType  outputType,
long  value 
) throws Exception
inlinestaticprivate

◆ assertVarintRoundTrip() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.assertVarintRoundTrip ( OutputType  outputType,
long  value 
) throws Exception
inlinestaticprivate

◆ assertWriteLittleEndian32() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteLittleEndian32 ( byte[]  data,
int  value 
) throws Exception
inlinestaticprivate

Parses the given bytes using writeRawLittleEndian32() and checks that the result matches the given value.

Definition at line 650 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ assertWriteLittleEndian32() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteLittleEndian32 ( byte[]  data,
int  value 
) throws Exception
inlinestaticprivate

Parses the given bytes using writeRawLittleEndian32() and checks that the result matches the given value.

Definition at line 680 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ assertWriteLittleEndian64() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteLittleEndian64 ( byte[]  data,
long  value 
) throws Exception
inlinestaticprivate

Parses the given bytes using writeRawLittleEndian64() and checks that the result matches the given value.

Definition at line 671 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ assertWriteLittleEndian64() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteLittleEndian64 ( byte[]  data,
long  value 
) throws Exception
inlinestaticprivate

Parses the given bytes using writeRawLittleEndian64() and checks that the result matches the given value.

Definition at line 701 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ assertWriteVarint() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteVarint ( byte[]  data,
long  value 
) throws Exception
inlinestaticprivate

Writes the given value using writeRawVarint32() and writeRawVarint64() and checks that the result matches the given bytes.

Definition at line 740 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ assertWriteVarint() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.assertWriteVarint ( byte[]  data,
long  value 
) throws Exception
inlinestaticprivate

Writes the given value using writeRawVarint32() and writeRawVarint64() and checks that the result matches the given bytes.

Definition at line 769 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ bytes() [1/2]

static byte [] com.google.protobuf.CodedOutputStreamTest.bytes ( int...  bytesAsInts)
inlinestaticprivate

Helper to construct a byte array from a bunch of bytes. The inputs are actually ints so that I can use hex notation and not get stupid errors about precision.

Definition at line 715 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ bytes() [2/2]

static byte [] com.google.protobuf.CodedOutputStreamTest.bytes ( int...  bytesAsInts)
inlinestaticprivate

Helper to construct a byte array from a bunch of bytes. The inputs are actually ints so that I can use hex notation and not get stupid errors about precision.

Definition at line 744 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ fullString() [1/2]

static String com.google.protobuf.CodedOutputStreamTest.fullString ( char  c,
int  length 
)
inlinestaticprivate

◆ fullString() [2/2]

static String com.google.protobuf.CodedOutputStreamTest.fullString ( char  c,
int  length 
)
inlinestaticprivate

◆ newString() [1/2]

static String com.google.protobuf.CodedOutputStreamTest.newString ( char...  chars)
inlinestaticprivate

◆ newString() [2/2]

static String com.google.protobuf.CodedOutputStreamTest.newString ( char...  chars)
inlinestaticprivate

◆ testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace ( ) throws Exception
inline

◆ testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testCorrectExceptionThrowWhenEncodingStringsWithoutEnoughSpace ( ) throws Exception
inline

◆ testDifferentStringLengths() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testDifferentStringLengths ( ) throws Exception
inline

◆ testDifferentStringLengths() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testDifferentStringLengths ( ) throws Exception
inline

◆ testEncodeZigZag() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testEncodeZigZag ( ) throws Exception
inline

Test encodeZigZag32() and encodeZigZag64().

Definition at line 295 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testEncodeZigZag() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testEncodeZigZag ( ) throws Exception
inline

Test encodeZigZag32() and encodeZigZag64().

Definition at line 301 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testEncodingOfString() [1/2]

static void com.google.protobuf.CodedOutputStreamTest.testEncodingOfString ( OutputType  outputType,
char  c,
int  length 
) throws Exception
inlinestaticprivate

◆ testEncodingOfString() [2/2]

static void com.google.protobuf.CodedOutputStreamTest.testEncodingOfString ( OutputType  outputType,
char  c,
int  length 
) throws Exception
inlinestaticprivate

◆ testGetTotalBytesWritten() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testGetTotalBytesWritten ( ) throws Exception
inline

◆ testGetTotalBytesWritten() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testGetTotalBytesWritten ( ) throws Exception
inline

◆ testNioEncodersWithInitialOffsets() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testNioEncodersWithInitialOffsets ( ) throws Exception
inline

◆ testNioEncodersWithInitialOffsets() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testNioEncodersWithInitialOffsets ( ) throws Exception
inline

◆ testSerializeInvalidUtf8() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeInvalidUtf8 ( ) throws Exception
inline

◆ testSerializeInvalidUtf8() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeInvalidUtf8 ( ) throws Exception
inline

◆ testSerializeInvalidUtf8FollowedByOutOfSpace() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeInvalidUtf8FollowedByOutOfSpace ( ) throws Exception
inline

◆ testSerializeInvalidUtf8FollowedByOutOfSpace() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeInvalidUtf8FollowedByOutOfSpace ( ) throws Exception
inline

◆ testSerializeUtf8_MultipleSmallWrites() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeUtf8_MultipleSmallWrites ( ) throws Exception
inline

◆ testSerializeUtf8_MultipleSmallWrites() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testSerializeUtf8_MultipleSmallWrites ( ) throws Exception
inline

◆ testVarintRoundTrips() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testVarintRoundTrips ( ) throws Exception
inline

Checks that invariants are maintained for varint round trip input and output.

Definition at line 227 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testVarintRoundTrips() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testVarintRoundTrips ( ) throws Exception
inline

Checks that invariants are maintained for varint round trip input and output.

Definition at line 230 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteByteArrayWithOffsets() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteByteArrayWithOffsets ( ) throws Exception
inline

◆ testWriteByteArrayWithOffsets() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteByteArrayWithOffsets ( ) throws Exception
inline

◆ testWriteByteBuffer() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteByteBuffer ( ) throws Exception
inline

◆ testWriteByteBuffer() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteByteBuffer ( ) throws Exception
inline

◆ testWriteLittleEndian() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteLittleEndian ( ) throws Exception
inline

Tests writeRawLittleEndian32() and writeRawLittleEndian64().

Definition at line 284 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteLittleEndian() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteLittleEndian ( ) throws Exception
inline

Tests writeRawLittleEndian32() and writeRawLittleEndian64().

Definition at line 289 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteMessageWithNegativeEnumValue() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteMessageWithNegativeEnumValue ( ) throws Exception
inline

Test writing a message containing a negative enum value. This used to fail because the size was not properly computed as a sign-extended varint.

Definition at line 381 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteMessageWithNegativeEnumValue() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteMessageWithNegativeEnumValue ( ) throws Exception
inline

Test writing a message containing a negative enum value. This used to fail because the size was not properly computed as a sign-extended varint.

Definition at line 399 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteStringNoTag_fastpath() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteStringNoTag_fastpath ( ) throws Exception
inline

◆ testWriteStringNoTag_fastpath() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteStringNoTag_fastpath ( ) throws Exception
inline

◆ testWriteToByteBuffer() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteToByteBuffer ( ) throws Exception
inline

◆ testWriteToByteBuffer() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteToByteBuffer ( ) throws Exception
inline

◆ testWriteVarint() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteVarint ( ) throws Exception
inline

Tests writeRawVarint32() and writeRawVarint64().

Definition at line 241 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteVarint() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteVarint ( ) throws Exception
inline

Tests writeRawVarint32() and writeRawVarint64().

Definition at line 245 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteWholeMessage() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteWholeMessage ( ) throws Exception
inline

Tests writing a whole message with every field type.

Definition at line 339 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteWholeMessage() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteWholeMessage ( ) throws Exception
inline

Tests writing a whole message with every field type.

Definition at line 355 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteWholePackedFieldsMessage() [1/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteWholePackedFieldsMessage ( ) throws Exception
inline

Tests writing a whole message with every packed field type. Ensures the wire format of packed fields is compatible with C++.

Definition at line 364 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ testWriteWholePackedFieldsMessage() [2/2]

void com.google.protobuf.CodedOutputStreamTest.testWriteWholePackedFieldsMessage ( ) throws Exception
inline

Tests writing a whole message with every packed field type. Ensures the wire format of packed fields is compatible with C++.

Definition at line 381 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ toList() [1/2]

static List<Byte> com.google.protobuf.CodedOutputStreamTest.toList ( byte[]  bytes)
inlinestaticprivate

Arrays.asList() does not work with arrays of primitives. :(

Definition at line 724 of file bloaty/third_party/protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.

◆ toList() [2/2]

static List<Byte> com.google.protobuf.CodedOutputStreamTest.toList ( byte[]  bytes)
inlinestaticprivate

Arrays.asList() does not work with arrays of primitives. :(

Definition at line 753 of file protobuf/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java.


The documentation for this class was generated from the following file:


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:04