Brian Silverman | eb16fa4 | 2016-02-20 15:29:56 -0500 | [diff] [blame^] | 1 | #include "gtest/gtest.h" |
2 | |||||
3 | #include "build_tests/proto.pb.h" | ||||
4 | |||||
5 | TEST(ProtoBuildTest, Serialize) { | ||||
6 | ::frc971::TestProto test_proto1, test_proto2; | ||||
7 | test_proto1.set_s("Hi!"); | ||||
8 | test_proto1.set_i(971); | ||||
9 | |||||
10 | ::std::string serialized; | ||||
11 | ASSERT_TRUE(test_proto1.SerializeToString(&serialized)); | ||||
12 | ASSERT_TRUE(test_proto2.ParseFromString(serialized)); | ||||
13 | |||||
14 | EXPECT_EQ("Hi!", test_proto2.s()); | ||||
15 | EXPECT_EQ(971, test_proto2.i()); | ||||
16 | } |