MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST

Function TEST

tensorflow/core/lib/strings/ordered_code_test.cc:216–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216TEST(OrderedCode, SkipToNextSpecialByte) {
217 for (size_t len = 0; len < 256; len++) {
218 random::PhiloxRandom philox(301, 17);
219 random::SimplePhilox rnd(&philox);
220 string x;
221 while (x.size() < len) {
222 char c = 1 + rnd.Uniform(254);
223 ASSERT_NE(c, 0);
224 ASSERT_NE(c, 255);
225 x += c; // No 0 bytes, no 255 bytes
226 }
227 EXPECT_EQ(FindSpecial(x), x.size());
228 for (size_t special_pos = 0; special_pos < len; special_pos++) {
229 for (size_t special_test = 0; special_test < 2; special_test++) {
230 const char special_byte = (special_test == 0) ? 0 : 255;
231 string y = x;
232 y[special_pos] = special_byte;
233 EXPECT_EQ(FindSpecial(y), special_pos);
234 if (special_pos < 16) {
235 // Add some special bytes after the one at special_pos to make sure
236 // we still return the earliest special byte in the string
237 for (size_t rest = special_pos + 1; rest < len; rest++) {
238 if (rnd.OneIn(3)) {
239 y[rest] = rnd.OneIn(2) ? 0 : 255;
240 EXPECT_EQ(FindSpecial(y), special_pos);
241 }
242 }
243 }
244 }
245 }
246 }
247}
248
249TEST(OrderedCode, ExhaustiveFindSpecial) {
250 char buf[16];

Callers

nothing calls this directly

Calls 15

FindSpecialFunction · 0.85
StrNotFunction · 0.85
EXPECT_DEATHFunction · 0.85
TestWriteReadFunction · 0.85
TestWriteAppendsFunction · 0.85
EncodeStringIncreasingFunction · 0.85
ReadStringFunction · 0.85
ByteSequenceFunction · 0.85
UniformMethod · 0.80
OneInMethod · 0.80
rbeginMethod · 0.80
RandomStringFunction · 0.70

Tested by

no test coverage detected