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

Public Member Functions

void testIsValidUtf8_1Byte ()
 
void testIsValidUtf8_1Byte ()
 
void testIsValidUtf8_2Bytes ()
 
void testIsValidUtf8_2Bytes ()
 
void testIsValidUtf8_3Bytes ()
 
void testIsValidUtf8_3Bytes ()
 
void testIsValidUtf8_4BytesSamples ()
 
void testIsValidUtf8_4BytesSamples ()
 
void testShardsHaveExpectedRoundTrippables ()
 
void testShardsHaveExpectedRoundTrippables ()
 
void testSomeSequences ()
 
void testSomeSequences ()
 

Private Member Functions

void assertInvalidUtf8 (int... bytes)
 
void assertInvalidUtf8 (int... bytes)
 
void assertValidUtf8 (ByteStringFactory factory, int[] bytes, boolean not)
 
void assertValidUtf8 (ByteStringFactory factory, int[] bytes, boolean not)
 
void assertValidUtf8 (int... bytes)
 
void assertValidUtf8 (int... bytes)
 
byte[] toByteArray (int... bytes)
 
byte[] toByteArray (int... bytes)
 

Static Private Member Functions

static ByteString asBytes (String s)
 
static ByteString asBytes (String s)
 

Detailed Description

Tests cases for ByteString#isValidUtf8(). This includes three brute force tests that actually test every permutation of one byte, two byte, and three byte sequences to ensure that the method produces the right result for every possible byte encoding where "right" means it's consistent with java's UTF-8 string encoding/decoding such that the method returns true for any sequence that will round trip when converted to a String and then back to bytes and will return false for any sequence that will not round trip. See also IsValidUtf8FourByteTest. It also includes some other more targeted tests.

Author
jonp@.nosp@m.goog.nosp@m.le.co.nosp@m.m (Jon Perlow)
marti.nosp@m.nrb@.nosp@m.googl.nosp@m.e.co.nosp@m.m (Martin Buchholz)

Tests cases for ByteString#isValidUtf8(). This includes three brute force tests that actually test every permutation of one byte, two byte, and three byte sequences to ensure that the method produces the right result for every possible byte encoding where "right" means it's consistent with java's UTF-8 string encoding/decoding such that the method returns true for any sequence that will round trip when converted to a String and then back to bytes and will return false for any sequence that will not round trip. See also IsValidUtf8FourByteTest. It also includes some other more targeted tests.

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

Member Function Documentation

◆ asBytes() [1/2]

static ByteString com.google.protobuf.IsValidUtf8Test.asBytes ( String  s)
inlinestaticprivate

◆ asBytes() [2/2]

static ByteString com.google.protobuf.IsValidUtf8Test.asBytes ( String  s)
inlinestaticprivate

◆ assertInvalidUtf8() [1/2]

void com.google.protobuf.IsValidUtf8Test.assertInvalidUtf8 ( int...  bytes)
inlineprivate

◆ assertInvalidUtf8() [2/2]

void com.google.protobuf.IsValidUtf8Test.assertInvalidUtf8 ( int...  bytes)
inlineprivate

◆ assertValidUtf8() [1/4]

void com.google.protobuf.IsValidUtf8Test.assertValidUtf8 ( ByteStringFactory  factory,
int[]  bytes,
boolean  not 
)
inlineprivate

◆ assertValidUtf8() [2/4]

void com.google.protobuf.IsValidUtf8Test.assertValidUtf8 ( ByteStringFactory  factory,
int[]  bytes,
boolean  not 
)
inlineprivate

◆ assertValidUtf8() [3/4]

void com.google.protobuf.IsValidUtf8Test.assertValidUtf8 ( int...  bytes)
inlineprivate

◆ assertValidUtf8() [4/4]

void com.google.protobuf.IsValidUtf8Test.assertValidUtf8 ( int...  bytes)
inlineprivate

◆ testIsValidUtf8_1Byte() [1/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_1Byte ( )
inline

Tests that round tripping of all two byte permutations work.

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

◆ testIsValidUtf8_1Byte() [2/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_1Byte ( )
inline

Tests that round tripping of all two byte permutations work.

Definition at line 61 of file protobuf/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.

◆ testIsValidUtf8_2Bytes() [1/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_2Bytes ( )
inline

Tests that round tripping of all two byte permutations work.

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

◆ testIsValidUtf8_2Bytes() [2/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_2Bytes ( )
inline

Tests that round tripping of all two byte permutations work.

Definition at line 70 of file protobuf/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.

◆ testIsValidUtf8_3Bytes() [1/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_3Bytes ( )
inline

Tests that round tripping of all three byte permutations work.

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

◆ testIsValidUtf8_3Bytes() [2/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_3Bytes ( )
inline

Tests that round tripping of all three byte permutations work.

Definition at line 79 of file protobuf/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.

◆ testIsValidUtf8_4BytesSamples() [1/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_4BytesSamples ( )
inline

Tests that round tripping of a sample of four byte permutations work. All permutations are prohibitively expensive to test for automated runs; IsValidUtf8FourByteTest is used for full coverage. This method tests specific four-byte cases.

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

◆ testIsValidUtf8_4BytesSamples() [2/2]

void com.google.protobuf.IsValidUtf8Test.testIsValidUtf8_4BytesSamples ( )
inline

Tests that round tripping of a sample of four byte permutations work. All permutations are prohibitively expensive to test for automated runs; IsValidUtf8FourByteTest is used for full coverage. This method tests specific four-byte cases.

Definition at line 92 of file protobuf/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.

◆ testShardsHaveExpectedRoundTrippables() [1/2]

void com.google.protobuf.IsValidUtf8Test.testShardsHaveExpectedRoundTrippables ( )
inline

◆ testShardsHaveExpectedRoundTrippables() [2/2]

void com.google.protobuf.IsValidUtf8Test.testShardsHaveExpectedRoundTrippables ( )
inline

◆ testSomeSequences() [1/2]

void com.google.protobuf.IsValidUtf8Test.testSomeSequences ( )
inline

Tests some hard-coded test cases.

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

◆ testSomeSequences() [2/2]

void com.google.protobuf.IsValidUtf8Test.testSomeSequences ( )
inline

Tests some hard-coded test cases.

Definition at line 107 of file protobuf/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java.

◆ toByteArray() [1/2]

byte [] com.google.protobuf.IsValidUtf8Test.toByteArray ( int...  bytes)
inlineprivate

◆ toByteArray() [2/2]

byte [] com.google.protobuf.IsValidUtf8Test.toByteArray ( int...  bytes)
inlineprivate

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


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