aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util/byte_buffer_test.cc
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2015-06-22 23:30:00 -0700
committerGravatar yang-g <yangg@google.com>2015-06-22 23:30:00 -0700
commitb1bbc8764db510547ac2b98168e86ee84c3d234b (patch)
tree97839b8d6b1df167ca530be05fecb93ee83be221 /test/cpp/util/byte_buffer_test.cc
parent89c5a5623377e7d4d253c7a304bc726357c6ef0e (diff)
proper init const char *
Diffstat (limited to 'test/cpp/util/byte_buffer_test.cc')
-rw-r--r--test/cpp/util/byte_buffer_test.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 8ad2fad505..13eb49730a 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -43,21 +43,21 @@
namespace grpc {
namespace {
+const char* kContent1 = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
+
class ByteBufferTest : public ::testing::Test {
- protected:
- const char* kContent1_ = "hello xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
- const char* kContent2_ = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
};
TEST_F(ByteBufferTest, CreateFromSingleSlice) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1_);
+ gpr_slice hello = gpr_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
}
TEST_F(ByteBufferTest, CreateFromVector) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1_);
- gpr_slice world = gpr_slice_from_copied_string(kContent2_);
+ gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ gpr_slice world = gpr_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
@@ -65,20 +65,20 @@ TEST_F(ByteBufferTest, CreateFromVector) {
}
TEST_F(ByteBufferTest, Clear) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1_);
+ gpr_slice hello = gpr_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
buffer.Clear();
}
TEST_F(ByteBufferTest, Length) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1_);
- gpr_slice world = gpr_slice_from_copied_string(kContent2_);
+ gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ gpr_slice world = gpr_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
ByteBuffer buffer(&slices[0], 2);
- EXPECT_EQ(strlen(kContent1_) + strlen(kContent2_), buffer.Length());
+ EXPECT_EQ(strlen(kContent1) + strlen(kContent2), buffer.Length());
}
bool SliceEqual(const Slice& a, gpr_slice b) {
@@ -94,8 +94,8 @@ bool SliceEqual(const Slice& a, gpr_slice b) {
}
TEST_F(ByteBufferTest, Dump) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1_);
- gpr_slice world = gpr_slice_from_copied_string(kContent2_);
+ gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ gpr_slice world = gpr_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));