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

Function TEST

tensorflow/core/platform/stringpiece_test.cc:24–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22namespace tensorflow {
23
24TEST(StringPiece, Ctor) {
25 {
26 // const char* without size.
27 const char* hello = "hello";
28 StringPiece s20(hello);
29 EXPECT_TRUE(s20.data() == hello);
30 EXPECT_EQ(5, s20.size());
31
32 // const char* with size.
33 StringPiece s21(hello, 4);
34 EXPECT_TRUE(s21.data() == hello);
35 EXPECT_EQ(4, s21.size());
36
37 // Not recommended, but valid C++
38 StringPiece s22(hello, 6);
39 EXPECT_TRUE(s22.data() == hello);
40 EXPECT_EQ(6, s22.size());
41 }
42
43 {
44 string hola = "hola";
45 StringPiece s30(hola);
46 EXPECT_TRUE(s30.data() == hola.data());
47 EXPECT_EQ(4, s30.size());
48
49 // std::string with embedded '\0'.
50 hola.push_back('\0');
51 hola.append("h2");
52 hola.push_back('\0');
53 StringPiece s31(hola);
54 EXPECT_TRUE(s31.data() == hola.data());
55 EXPECT_EQ(8, s31.size());
56 }
57}
58
59TEST(StringPiece, ConversionToString) {
60 EXPECT_EQ("", string(StringPiece("")));

Callers

nothing calls this directly

Calls 4

dataMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected