blob: 01de461afdfeb87e3a297ba4fdb065dbf06f4915 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
// This is simply a script that tries serializing protocol buffer in text
// format. Nothing special here and no actual code is being tested.
#include <string>
#include "google/protobuf/text_format.h"
#include "gtest/gtest.h"
#include "caffe/proto/caffe.pb.h"
#include "caffe/test/test_caffe_main.hpp"
namespace caffe {
class ProtoTest : public ::testing::Test {};
TEST_F(ProtoTest, TestSerialization) {
LayerParameter param;
param.set_name("test");
param.set_type("Test");
std::cout << "Printing in binary format." << std::endl;
std::cout << param.SerializeAsString() << std::endl;
std::cout << "Printing in text format." << std::endl;
std::string str;
google::protobuf::TextFormat::PrintToString(param, &str);
std::cout << str << std::endl;
EXPECT_TRUE(true);
}
} // namespace caffe
|