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_2Bytes ()
 
void testIsValidUtf8_3Bytes ()
 
void testIsValidUtf8_4BytesSamples ()
 
void testShardsHaveExpectedRoundTrippables ()
 
void testSomeSequences ()
 

Private Member Functions

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

Static Private Member Functions

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)

Definition at line 56 of file IsValidUtf8Test.java.

Member Function Documentation

◆ asBytes()

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

Definition at line 163 of file IsValidUtf8Test.java.

◆ assertInvalidUtf8()

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

Definition at line 157 of file IsValidUtf8Test.java.

◆ assertValidUtf8() [1/2]

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

Definition at line 131 of file IsValidUtf8Test.java.

◆ assertValidUtf8() [2/2]

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

Definition at line 151 of file IsValidUtf8Test.java.

◆ testIsValidUtf8_1Byte()

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

Tests that round tripping of all two byte permutations work.

Definition at line 58 of file IsValidUtf8Test.java.

◆ testIsValidUtf8_2Bytes()

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

Tests that round tripping of all two byte permutations work.

Definition at line 65 of file IsValidUtf8Test.java.

◆ testIsValidUtf8_3Bytes()

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

Tests that round tripping of all three byte permutations work.

Definition at line 72 of file IsValidUtf8Test.java.

◆ testIsValidUtf8_4BytesSamples()

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 IsValidUtf8Test.java.

◆ testShardsHaveExpectedRoundTrippables()

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

Definition at line 167 of file IsValidUtf8Test.java.

◆ testSomeSequences()

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

Tests some hard-coded test cases.

Definition at line 100 of file IsValidUtf8Test.java.

◆ toByteArray()

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

Definition at line 123 of file IsValidUtf8Test.java.


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


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:07