| 23 | namespace histogram { |
| 24 | |
| 25 | static void Validate(const Histogram& h) { |
| 26 | string s1 = h.ToString(); |
| 27 | LOG(ERROR) << s1; |
| 28 | |
| 29 | HistogramProto proto_with_zeroes; |
| 30 | h.EncodeToProto(&proto_with_zeroes, true); |
| 31 | Histogram h2; |
| 32 | EXPECT_TRUE(h2.DecodeFromProto(proto_with_zeroes)); |
| 33 | string s2 = h2.ToString(); |
| 34 | LOG(ERROR) << s2; |
| 35 | |
| 36 | EXPECT_EQ(s1, s2); |
| 37 | |
| 38 | HistogramProto proto_no_zeroes; |
| 39 | h.EncodeToProto(&proto_no_zeroes, false); |
| 40 | LOG(ERROR) << proto_no_zeroes.DebugString(); |
| 41 | Histogram h3; |
| 42 | EXPECT_TRUE(h3.DecodeFromProto(proto_no_zeroes)); |
| 43 | string s3 = h3.ToString(); |
| 44 | LOG(ERROR) << s3; |
| 45 | |
| 46 | EXPECT_EQ(s1, s3); |
| 47 | } |
| 48 | |
| 49 | TEST(Histogram, Empty) { |
| 50 | Histogram h; |
no test coverage detected