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