26 #include "../../codec.h"
32 #include "../../binary.h"
37 std::cout <<
"Try encode..." << std::endl;
39 codec.encode(&bytes, msg_in);
40 std::cout <<
"... got bytes (hex): " <<
dccl::hex_encode(bytes) << std::endl;
42 std::cout <<
"Try decode..." << std::endl;
44 auto msg_out = codec.decode<std::unique_ptr<google::protobuf::Message>>(bytes);
45 std::cout <<
"... got Message out:\n" << msg_out->DebugString() << std::endl;
46 assert(msg_in.SerializeAsString() == msg_out->SerializeAsString());
49 int main(
int ,
char* [])
51 dccl::dlog.
connect(dccl::logger::ALL, &std::cerr);
54 codec.load_library(
"libtest_autoload" SHARED_LIBRARY_SUFFIX);
56 codec.info_all(&std::cout);
60 run_test(codec, msg_in1);
64 run_test(codec, msg_in2);
68 run_test(codec, msg_in3);
70 TestMessage3SupersetName msg_in4;
72 run_test(codec, msg_in4);
74 std::cout <<
"all tests passed" << std::endl;