| 78 | class test_compress_method : public testing::Test {}; |
| 79 | |
| 80 | TEST_F(test_compress_method, snappy) { |
| 81 | snappy_message::SnappyMessageProto old_msg; |
| 82 | old_msg.set_text("Hello World!"); |
| 83 | old_msg.add_numbers(2); |
| 84 | old_msg.add_numbers(7); |
| 85 | old_msg.add_numbers(45); |
| 86 | butil::IOBuf buf; |
| 87 | ASSERT_TRUE(brpc::policy::SnappyCompress(old_msg, &buf)); |
| 88 | snappy_message::SnappyMessageProto new_msg; |
| 89 | ASSERT_TRUE(brpc::policy::SnappyDecompress(buf, &new_msg)); |
| 90 | ASSERT_TRUE(strcmp(new_msg.text().c_str(), "Hello World!") == 0); |
| 91 | ASSERT_TRUE(new_msg.numbers_size() == 3); |
| 92 | ASSERT_EQ(new_msg.numbers(0), 2); |
| 93 | ASSERT_EQ(new_msg.numbers(1), 7); |
| 94 | ASSERT_EQ(new_msg.numbers(2), 45); |
| 95 | } |
| 96 | |
| 97 | TEST_F(test_compress_method, snappy_iobuf) { |
| 98 | butil::IOBuf buf, output_buf, check_buf; |
nothing calls this directly
no test coverage detected