PageRenderTime 56ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/src/test/cxx-generate-packed-data.cc

http://protobuf-c.googlecode.com/
C++ | 1057 lines | 927 code | 122 blank | 8 comment | 6 complexity | 4045a5240a630dd0b2fbbb872fe4910f MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /* generate byte arrays that match the constructs in test-generated-code2.c.
  2. * these are tested against eachother to make sure the c and c++ agree. */
  3. #define __STDC_LIMIT_MACROS
  4. #include "generated-code/test-full.pb.h"
  5. #include <limits.h>
  6. # if defined(_MSC_VER)
  7. /* On windows, in ms visual studio, define the types ourselves */
  8. # define int32_t signed __int32
  9. # define INT32_MIN _I32_MIN
  10. # define INT32_MAX _I32_MAX
  11. # define uint32_t unsigned __int32
  12. # define UINT32_MIN _UI32_MIN
  13. # define UINT32_MAX _UI32_MAX
  14. # define int64_t signed __int64
  15. # define INT64_MIN _I64_MIN
  16. # define INT64_MAX _I64_MAX
  17. # define uint64_t unsigned __int64
  18. # define UINT64_MIN _UI64_MIN
  19. # define UINT64_MAX _UI64_MAX
  20. # define uint8_t unsigned char
  21. # else
  22. /* Use the system inttypes.h */
  23. # include <inttypes.h>
  24. # endif
  25. #include <stdio.h>
  26. using namespace foo;
  27. #define protobuf_c_boolean bool
  28. #define TEST_ENUM_SMALL_TYPE_NAME TestEnumSmall
  29. #define TEST_ENUM_SMALL(NAME) foo::NAME
  30. #define TEST_ENUM_TYPE_NAME TestEnum
  31. #define TEST_ENUM(NAME) foo::NAME
  32. #include "common-test-arrays.h"
  33. #define N_ELEMENTS(arr) (sizeof(arr)/sizeof((arr)[0]))
  34. static void
  35. dump_message_bytes(google::protobuf::Message *message,
  36. const char *label)
  37. {
  38. std::string rv;
  39. unsigned char *bytes;
  40. unsigned len;
  41. if (!message->SerializeToString(&rv))
  42. assert(0);
  43. bytes = (unsigned char *) rv.data();
  44. len = rv.size();
  45. printf ("static const uint8_t %s[%u] = { ", label, len);
  46. for (unsigned i = 0; i < len; i++) {
  47. if (i)
  48. printf (", ");
  49. printf ("0x%02x", bytes[i]);
  50. }
  51. printf (" };\n");
  52. }
  53. static void
  54. dump_test_enum_small (void)
  55. {
  56. TestMessRequiredEnumSmall es;
  57. es.set_test(VALUE);
  58. dump_message_bytes(&es, "test_enum_small_VALUE");
  59. es.set_test(OTHER_VALUE);
  60. dump_message_bytes(&es, "test_enum_small_OTHER_VALUE");
  61. }
  62. static void
  63. dump_test_enum_big (void)
  64. {
  65. TestMessRequiredEnum eb;
  66. eb.set_test(VALUE0); dump_message_bytes(&eb, "test_enum_big_VALUE0");
  67. eb.set_test(VALUE127); dump_message_bytes(&eb, "test_enum_big_VALUE127");
  68. eb.set_test(VALUE128); dump_message_bytes(&eb, "test_enum_big_VALUE128");
  69. eb.set_test(VALUE16383); dump_message_bytes(&eb, "test_enum_big_VALUE16383");
  70. eb.set_test(VALUE16384); dump_message_bytes(&eb, "test_enum_big_VALUE16384");
  71. eb.set_test(VALUE2097151); dump_message_bytes(&eb, "test_enum_big_VALUE2097151");
  72. eb.set_test(VALUE2097152); dump_message_bytes(&eb, "test_enum_big_VALUE2097152");
  73. eb.set_test(VALUE268435455); dump_message_bytes(&eb, "test_enum_big_VALUE268435455");
  74. eb.set_test(VALUE268435456); dump_message_bytes(&eb, "test_enum_big_VALUE268435456");
  75. }
  76. static void
  77. dump_test_field_numbers (void)
  78. {
  79. #define DUMP_ONE(num) \
  80. { TestFieldNo##num f; \
  81. f.set_test("tst"); \
  82. dump_message_bytes(&f, "test_field_number_" #num); }
  83. DUMP_ONE (15)
  84. DUMP_ONE (16)
  85. DUMP_ONE (2047)
  86. DUMP_ONE (2048)
  87. DUMP_ONE (262143)
  88. DUMP_ONE (262144)
  89. DUMP_ONE (33554431)
  90. DUMP_ONE (33554432)
  91. #undef DUMP_ONE
  92. }
  93. static void dump_test_required_int32 (void)
  94. {
  95. TestMessRequiredInt32 mess;
  96. mess.set_test (INT32_MIN);
  97. dump_message_bytes (&mess, "test_required_int32_min");
  98. mess.set_test (-1000);
  99. dump_message_bytes (&mess, "test_required_int32_m1000");
  100. mess.set_test (0);
  101. dump_message_bytes (&mess, "test_required_int32_0");
  102. mess.set_test (INT32_MAX);
  103. dump_message_bytes (&mess, "test_required_int32_max");
  104. }
  105. static void dump_test_required_sint32 (void)
  106. {
  107. TestMessRequiredSInt32 mess;
  108. mess.set_test (INT32_MIN);
  109. dump_message_bytes (&mess, "test_required_sint32_min");
  110. mess.set_test (-1000);
  111. dump_message_bytes (&mess, "test_required_sint32_m1000");
  112. mess.set_test (0);
  113. dump_message_bytes (&mess, "test_required_sint32_0");
  114. mess.set_test (INT32_MAX);
  115. dump_message_bytes (&mess, "test_required_sint32_max");
  116. }
  117. static void dump_test_required_sfixed32 (void)
  118. {
  119. TestMessRequiredSFixed32 mess;
  120. mess.set_test (INT32_MIN);
  121. dump_message_bytes (&mess, "test_required_sfixed32_min");
  122. mess.set_test (-1000);
  123. dump_message_bytes (&mess, "test_required_sfixed32_m1000");
  124. mess.set_test (0);
  125. dump_message_bytes (&mess, "test_required_sfixed32_0");
  126. mess.set_test (INT32_MAX);
  127. dump_message_bytes (&mess, "test_required_sfixed32_max");
  128. }
  129. static void dump_test_required_uint32 (void)
  130. {
  131. TestMessRequiredUInt32 mess;
  132. mess.set_test (0);
  133. dump_message_bytes (&mess, "test_required_uint32_0");
  134. mess.set_test (MILLION);
  135. dump_message_bytes (&mess, "test_required_uint32_million");
  136. mess.set_test (UINT32_MAX);
  137. dump_message_bytes (&mess, "test_required_uint32_max");
  138. }
  139. static void dump_test_required_fixed32 (void)
  140. {
  141. TestMessRequiredFixed32 mess;
  142. mess.set_test (0);
  143. dump_message_bytes (&mess, "test_required_fixed32_0");
  144. mess.set_test (MILLION);
  145. dump_message_bytes (&mess, "test_required_fixed32_million");
  146. mess.set_test (UINT32_MAX);
  147. dump_message_bytes (&mess, "test_required_fixed32_max");
  148. }
  149. static void dump_test_required_int64 (void)
  150. {
  151. TestMessRequiredInt64 mess;
  152. mess.set_test (INT64_MIN);
  153. dump_message_bytes (&mess, "test_required_int64_min");
  154. mess.set_test (-TRILLION);
  155. dump_message_bytes (&mess, "test_required_int64_mtril");
  156. mess.set_test (0);
  157. dump_message_bytes (&mess, "test_required_int64_0");
  158. mess.set_test (QUADRILLION);
  159. dump_message_bytes (&mess, "test_required_int64_quad");
  160. mess.set_test (INT64_MAX);
  161. dump_message_bytes (&mess, "test_required_int64_max");
  162. }
  163. static void dump_test_required_sint64 (void)
  164. {
  165. TestMessRequiredSInt64 mess;
  166. mess.set_test (INT64_MIN);
  167. dump_message_bytes (&mess, "test_required_sint64_min");
  168. mess.set_test (-TRILLION);
  169. dump_message_bytes (&mess, "test_required_sint64_mtril");
  170. mess.set_test (0);
  171. dump_message_bytes (&mess, "test_required_sint64_0");
  172. mess.set_test (QUADRILLION);
  173. dump_message_bytes (&mess, "test_required_sint64_quad");
  174. mess.set_test (INT64_MAX);
  175. dump_message_bytes (&mess, "test_required_sint64_max");
  176. }
  177. static void dump_test_required_sfixed64 (void)
  178. {
  179. TestMessRequiredSFixed64 mess;
  180. mess.set_test (INT64_MIN);
  181. dump_message_bytes (&mess, "test_required_sfixed64_min");
  182. mess.set_test (-TRILLION);
  183. dump_message_bytes (&mess, "test_required_sfixed64_mtril");
  184. mess.set_test (0);
  185. dump_message_bytes (&mess, "test_required_sfixed64_0");
  186. mess.set_test (QUADRILLION);
  187. dump_message_bytes (&mess, "test_required_sfixed64_quad");
  188. mess.set_test (INT64_MAX);
  189. dump_message_bytes (&mess, "test_required_sfixed64_max");
  190. }
  191. static void dump_test_required_uint64 (void)
  192. {
  193. TestMessRequiredUInt64 mess;
  194. mess.set_test (0);
  195. dump_message_bytes (&mess, "test_required_uint64_0");
  196. mess.set_test (THOUSAND);
  197. dump_message_bytes (&mess, "test_required_uint64_thou");
  198. mess.set_test (MILLION);
  199. dump_message_bytes (&mess, "test_required_uint64_mill");
  200. mess.set_test (BILLION);
  201. dump_message_bytes (&mess, "test_required_uint64_bill");
  202. mess.set_test (TRILLION);
  203. dump_message_bytes (&mess, "test_required_uint64_tril");
  204. mess.set_test (QUADRILLION);
  205. dump_message_bytes (&mess, "test_required_uint64_quad");
  206. mess.set_test (QUINTILLION);
  207. dump_message_bytes (&mess, "test_required_uint64_quint");
  208. mess.set_test (UINT64_MAX);
  209. dump_message_bytes (&mess, "test_required_uint64_max");
  210. }
  211. static void dump_test_required_fixed64 (void)
  212. {
  213. TestMessRequiredFixed64 mess;
  214. mess.set_test (0);
  215. dump_message_bytes (&mess, "test_required_fixed64_0");
  216. mess.set_test (THOUSAND);
  217. dump_message_bytes (&mess, "test_required_fixed64_thou");
  218. mess.set_test (MILLION);
  219. dump_message_bytes (&mess, "test_required_fixed64_mill");
  220. mess.set_test (BILLION);
  221. dump_message_bytes (&mess, "test_required_fixed64_bill");
  222. mess.set_test (TRILLION);
  223. dump_message_bytes (&mess, "test_required_fixed64_tril");
  224. mess.set_test (QUADRILLION);
  225. dump_message_bytes (&mess, "test_required_fixed64_quad");
  226. mess.set_test (QUINTILLION);
  227. dump_message_bytes (&mess, "test_required_fixed64_quint");
  228. mess.set_test (UINT64_MAX);
  229. dump_message_bytes (&mess, "test_required_fixed64_max");
  230. }
  231. static void dump_test_required_float (void)
  232. {
  233. TestMessRequiredFloat mess;
  234. mess.set_test(-THOUSAND);
  235. dump_message_bytes (&mess, "test_required_float_mthou");
  236. mess.set_test(0);
  237. dump_message_bytes (&mess, "test_required_float_0");
  238. mess.set_test(420);
  239. dump_message_bytes (&mess, "test_required_float_420");
  240. }
  241. static void dump_test_required_double (void)
  242. {
  243. TestMessRequiredDouble mess;
  244. mess.set_test(-THOUSAND);
  245. dump_message_bytes (&mess, "test_required_double_mthou");
  246. mess.set_test(0);
  247. dump_message_bytes (&mess, "test_required_double_0");
  248. mess.set_test(420);
  249. dump_message_bytes (&mess, "test_required_double_420");
  250. }
  251. static void dump_test_required_bool (void)
  252. {
  253. TestMessRequiredBool mess;
  254. mess.set_test(false);
  255. dump_message_bytes (&mess, "test_required_bool_0");
  256. mess.set_test(true);
  257. dump_message_bytes (&mess, "test_required_bool_1");
  258. }
  259. static void dump_test_required_enum_small (void)
  260. {
  261. TestMessRequiredEnumSmall mess;
  262. mess.set_test(VALUE);
  263. dump_message_bytes (&mess, "test_required_enum_small_VALUE");
  264. mess.set_test(OTHER_VALUE);
  265. dump_message_bytes (&mess, "test_required_enum_small_OTHER_VALUE");
  266. }
  267. static void dump_test_required_enum (void)
  268. {
  269. TestMessRequiredEnum mess;
  270. mess.set_test (VALUE0);
  271. dump_message_bytes (&mess, "test_required_enum_0");
  272. mess.set_test (VALUE1);
  273. dump_message_bytes (&mess, "test_required_enum_1");
  274. mess.set_test (VALUE127);
  275. dump_message_bytes (&mess, "test_required_enum_127");
  276. mess.set_test (VALUE128);
  277. dump_message_bytes (&mess, "test_required_enum_128");
  278. mess.set_test (VALUE16383);
  279. dump_message_bytes (&mess, "test_required_enum_16383");
  280. mess.set_test (VALUE16384);
  281. dump_message_bytes (&mess, "test_required_enum_16384");
  282. mess.set_test (VALUE2097151);
  283. dump_message_bytes (&mess, "test_required_enum_2097151");
  284. mess.set_test (VALUE2097152);
  285. dump_message_bytes (&mess, "test_required_enum_2097152");
  286. mess.set_test (VALUE268435455);
  287. dump_message_bytes (&mess, "test_required_enum_268435455");
  288. mess.set_test (VALUE268435456);
  289. dump_message_bytes (&mess, "test_required_enum_268435456");
  290. }
  291. static void dump_test_required_string (void)
  292. {
  293. TestMessRequiredString mess;
  294. mess.set_test ("");
  295. dump_message_bytes(&mess, "test_required_string_empty");
  296. mess.set_test ("hello");
  297. dump_message_bytes(&mess, "test_required_string_hello");
  298. mess.set_test ("two hundred xs follow: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
  299. dump_message_bytes(&mess, "test_required_string_long");
  300. }
  301. static void dump_test_required_bytes (void)
  302. {
  303. TestMessRequiredBytes mess;
  304. mess.set_test ("");
  305. dump_message_bytes (&mess, "test_required_bytes_empty");
  306. mess.set_test ("hello");
  307. dump_message_bytes (&mess, "test_required_bytes_hello");
  308. mess.set_test (std::string("\1") + '\0' + "\375\2\4");
  309. dump_message_bytes (&mess, "test_required_bytes_random");
  310. }
  311. static void dump_test_required_message (void)
  312. {
  313. TestMessRequiredMessage mess;
  314. mess.mutable_test()->set_test(0);
  315. dump_message_bytes (&mess, "test_required_submess_0");
  316. mess.mutable_test()->set_test(42);
  317. dump_message_bytes (&mess, "test_required_submess_42");
  318. }
  319. static void dump_test_optional_int32 (void)
  320. {
  321. TestMessOptional opt;
  322. opt.set_test_int32 (INT32_MIN);
  323. dump_message_bytes (&opt, "test_optional_int32_min");
  324. opt.set_test_int32 (-1);
  325. dump_message_bytes (&opt, "test_optional_int32_m1");
  326. opt.set_test_int32 (0);
  327. dump_message_bytes (&opt, "test_optional_int32_0");
  328. opt.set_test_int32 (666);
  329. dump_message_bytes (&opt, "test_optional_int32_666");
  330. opt.set_test_int32 (INT32_MAX);
  331. dump_message_bytes (&opt, "test_optional_int32_max");
  332. }
  333. static void dump_test_optional_sint32 (void)
  334. {
  335. TestMessOptional opt;
  336. opt.set_test_sint32 (INT32_MIN);
  337. dump_message_bytes (&opt, "test_optional_sint32_min");
  338. opt.set_test_sint32 (-1);
  339. dump_message_bytes (&opt, "test_optional_sint32_m1");
  340. opt.set_test_sint32 (0);
  341. dump_message_bytes (&opt, "test_optional_sint32_0");
  342. opt.set_test_sint32 (666);
  343. dump_message_bytes (&opt, "test_optional_sint32_666");
  344. opt.set_test_sint32 (INT32_MAX);
  345. dump_message_bytes (&opt, "test_optional_sint32_max");
  346. }
  347. static void dump_test_optional_sfixed32 (void)
  348. {
  349. TestMessOptional opt;
  350. opt.set_test_sfixed32 (INT32_MIN);
  351. dump_message_bytes (&opt, "test_optional_sfixed32_min");
  352. opt.set_test_sfixed32 (-1);
  353. dump_message_bytes (&opt, "test_optional_sfixed32_m1");
  354. opt.set_test_sfixed32 (0);
  355. dump_message_bytes (&opt, "test_optional_sfixed32_0");
  356. opt.set_test_sfixed32 (666);
  357. dump_message_bytes (&opt, "test_optional_sfixed32_666");
  358. opt.set_test_sfixed32 (INT32_MAX);
  359. dump_message_bytes (&opt, "test_optional_sfixed32_max");
  360. }
  361. static void dump_test_optional_int64 (void)
  362. {
  363. TestMessOptional opt;
  364. opt.set_test_int64 (INT64_MIN);
  365. dump_message_bytes (&opt, "test_optional_int64_min");
  366. opt.set_test_int64 (-1111111111LL);
  367. dump_message_bytes (&opt, "test_optional_int64_m1111111111LL");
  368. opt.set_test_int64 (0);
  369. dump_message_bytes (&opt, "test_optional_int64_0");
  370. opt.set_test_int64 (QUINTILLION);
  371. dump_message_bytes (&opt, "test_optional_int64_quintillion");
  372. opt.set_test_int64 (INT64_MAX);
  373. dump_message_bytes (&opt, "test_optional_int64_max");
  374. }
  375. static void dump_test_optional_sint64 (void)
  376. {
  377. TestMessOptional opt;
  378. opt.set_test_sint64 (INT64_MIN);
  379. dump_message_bytes (&opt, "test_optional_sint64_min");
  380. opt.set_test_sint64 (-1111111111LL);
  381. dump_message_bytes (&opt, "test_optional_sint64_m1111111111LL");
  382. opt.set_test_sint64 (0);
  383. dump_message_bytes (&opt, "test_optional_sint64_0");
  384. opt.set_test_sint64 (QUINTILLION);
  385. dump_message_bytes (&opt, "test_optional_sint64_quintillion");
  386. opt.set_test_sint64 (INT64_MAX);
  387. dump_message_bytes (&opt, "test_optional_sint64_max");
  388. }
  389. static void dump_test_optional_sfixed64 (void)
  390. {
  391. TestMessOptional opt;
  392. opt.set_test_sfixed64 (INT64_MIN);
  393. dump_message_bytes (&opt, "test_optional_sfixed64_min");
  394. opt.set_test_sfixed64 (-1111111111LL);
  395. dump_message_bytes (&opt, "test_optional_sfixed64_m1111111111LL");
  396. opt.set_test_sfixed64 (0);
  397. dump_message_bytes (&opt, "test_optional_sfixed64_0");
  398. opt.set_test_sfixed64 (QUINTILLION);
  399. dump_message_bytes (&opt, "test_optional_sfixed64_quintillion");
  400. opt.set_test_sfixed64 (INT64_MAX);
  401. dump_message_bytes (&opt, "test_optional_sfixed64_max");
  402. }
  403. static void dump_test_optional_uint32 (void)
  404. {
  405. TestMessOptional opt;
  406. opt.set_test_uint32(0);
  407. dump_message_bytes (&opt, "test_optional_uint32_0");
  408. opt.set_test_uint32(669);
  409. dump_message_bytes (&opt, "test_optional_uint32_669");
  410. opt.set_test_uint32(UINT32_MAX);
  411. dump_message_bytes (&opt, "test_optional_uint32_max");
  412. }
  413. static void dump_test_optional_fixed32 (void)
  414. {
  415. TestMessOptional opt;
  416. opt.set_test_fixed32(0);
  417. dump_message_bytes (&opt, "test_optional_fixed32_0");
  418. opt.set_test_fixed32(669);
  419. dump_message_bytes (&opt, "test_optional_fixed32_669");
  420. opt.set_test_fixed32(UINT32_MAX);
  421. dump_message_bytes (&opt, "test_optional_fixed32_max");
  422. }
  423. static void dump_test_optional_uint64 (void)
  424. {
  425. TestMessOptional opt;
  426. opt.set_test_uint64(0);
  427. dump_message_bytes (&opt, "test_optional_uint64_0");
  428. opt.set_test_uint64(669669669669669ULL);
  429. dump_message_bytes (&opt, "test_optional_uint64_669669669669669");
  430. opt.set_test_uint64(UINT64_MAX);
  431. dump_message_bytes (&opt, "test_optional_uint64_max");
  432. }
  433. static void dump_test_optional_fixed64 (void)
  434. {
  435. TestMessOptional opt;
  436. opt.set_test_fixed64(0);
  437. dump_message_bytes (&opt, "test_optional_fixed64_0");
  438. opt.set_test_fixed64(669669669669669ULL);
  439. dump_message_bytes (&opt, "test_optional_fixed64_669669669669669");
  440. opt.set_test_fixed64(UINT64_MAX);
  441. dump_message_bytes (&opt, "test_optional_fixed64_max");
  442. }
  443. static void dump_test_optional_float (void)
  444. {
  445. TestMessOptional opt;
  446. opt.set_test_float (-100);
  447. dump_message_bytes (&opt, "test_optional_float_m100");
  448. opt.set_test_float (0);
  449. dump_message_bytes (&opt, "test_optional_float_0");
  450. opt.set_test_float (141243);
  451. dump_message_bytes (&opt, "test_optional_float_141243");
  452. }
  453. static void dump_test_optional_double (void)
  454. {
  455. TestMessOptional opt;
  456. opt.set_test_double (-100);
  457. dump_message_bytes (&opt, "test_optional_double_m100");
  458. opt.set_test_double (0);
  459. dump_message_bytes (&opt, "test_optional_double_0");
  460. opt.set_test_double (141243);
  461. dump_message_bytes (&opt, "test_optional_double_141243");
  462. }
  463. static void dump_test_optional_bool (void)
  464. {
  465. TestMessOptional opt;
  466. opt.set_test_boolean (false);
  467. dump_message_bytes (&opt, "test_optional_bool_0");
  468. opt.set_test_boolean (true);
  469. dump_message_bytes (&opt, "test_optional_bool_1");
  470. }
  471. static void dump_test_optional_enum_small (void)
  472. {
  473. TestMessOptional opt;
  474. opt.set_test_enum_small (VALUE);
  475. dump_message_bytes (&opt, "test_optional_enum_small_0");
  476. opt.set_test_enum_small (OTHER_VALUE);
  477. dump_message_bytes (&opt, "test_optional_enum_small_1");
  478. }
  479. static void dump_test_optional_enum (void)
  480. {
  481. TestMessOptional opt;
  482. //for a in 0 1 127 128 16383 16384 2097151 2097152 268435455 268435456 ; do
  483. //echo ' opt.set_test_enum (VALUE'$a');
  484. //dump_message_bytes (&opt, "test_optional_enum_'$a'");'
  485. //done
  486. opt.set_test_enum (VALUE0);
  487. dump_message_bytes (&opt, "test_optional_enum_0");
  488. opt.set_test_enum (VALUE1);
  489. dump_message_bytes (&opt, "test_optional_enum_1");
  490. opt.set_test_enum (VALUE127);
  491. dump_message_bytes (&opt, "test_optional_enum_127");
  492. opt.set_test_enum (VALUE128);
  493. dump_message_bytes (&opt, "test_optional_enum_128");
  494. opt.set_test_enum (VALUE16383);
  495. dump_message_bytes (&opt, "test_optional_enum_16383");
  496. opt.set_test_enum (VALUE16384);
  497. dump_message_bytes (&opt, "test_optional_enum_16384");
  498. opt.set_test_enum (VALUE2097151);
  499. dump_message_bytes (&opt, "test_optional_enum_2097151");
  500. opt.set_test_enum (VALUE2097152);
  501. dump_message_bytes (&opt, "test_optional_enum_2097152");
  502. opt.set_test_enum (VALUE268435455);
  503. dump_message_bytes (&opt, "test_optional_enum_268435455");
  504. opt.set_test_enum (VALUE268435456);
  505. dump_message_bytes (&opt, "test_optional_enum_268435456");
  506. }
  507. static void dump_test_optional_string (void)
  508. {
  509. TestMessOptional opt;
  510. opt.set_test_string ("");
  511. dump_message_bytes (&opt, "test_optional_string_empty");
  512. opt.set_test_string ("hello");
  513. dump_message_bytes (&opt, "test_optional_string_hello");
  514. }
  515. static void dump_test_optional_bytes (void)
  516. {
  517. TestMessOptional opt;
  518. opt.set_test_bytes ("");
  519. dump_message_bytes (&opt, "test_optional_bytes_empty");
  520. opt.set_test_bytes ("hello");
  521. dump_message_bytes (&opt, "test_optional_bytes_hello");
  522. opt.set_test_bytes (std::string("\1") + '\0' + "\375\2\4");
  523. dump_message_bytes (&opt, "test_optional_bytes_random");
  524. }
  525. static void dump_test_optional_message (void)
  526. {
  527. TestMessOptional opt;
  528. opt.mutable_test_message()->set_test(0);
  529. dump_message_bytes (&opt, "test_optional_submess_0");
  530. opt.mutable_test_message()->set_test(42);
  531. dump_message_bytes (&opt, "test_optional_submess_42");
  532. }
  533. #define DUMP_STATIC_ARRAY_GENERIC(member, static_array, output_array_name) \
  534. do{ \
  535. TestMess mess; \
  536. for (unsigned i = 0; i < N_ELEMENTS (static_array); i++) \
  537. mess.add_##member(static_array[i]); \
  538. dump_message_bytes(&mess, output_array_name); \
  539. }while(0)
  540. static void dump_test_repeated_int32 (void)
  541. {
  542. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  543. DUMP_STATIC_ARRAY_GENERIC(test_int32, static_array, output_array_name)
  544. DUMP_STATIC_ARRAY (int32_arr0, "test_repeated_int32_arr0");
  545. DUMP_STATIC_ARRAY (int32_arr1, "test_repeated_int32_arr1");
  546. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_repeated_int32_arr_min_max");
  547. #undef DUMP_STATIC_ARRAY
  548. }
  549. static void dump_test_repeated_sint32 (void)
  550. {
  551. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  552. DUMP_STATIC_ARRAY_GENERIC(test_sint32, static_array, output_array_name)
  553. DUMP_STATIC_ARRAY (int32_arr0, "test_repeated_sint32_arr0");
  554. DUMP_STATIC_ARRAY (int32_arr1, "test_repeated_sint32_arr1");
  555. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_repeated_sint32_arr_min_max");
  556. #undef DUMP_STATIC_ARRAY
  557. }
  558. static void dump_test_repeated_uint32 (void)
  559. {
  560. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  561. DUMP_STATIC_ARRAY_GENERIC(test_uint32, static_array, output_array_name)
  562. DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_repeated_uint32_roundnumbers");
  563. DUMP_STATIC_ARRAY (uint32_0_max, "test_repeated_uint32_0_max");
  564. #undef DUMP_STATIC_ARRAY
  565. }
  566. static void dump_test_repeated_sfixed32 (void)
  567. {
  568. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  569. DUMP_STATIC_ARRAY_GENERIC(test_sfixed32, static_array, output_array_name)
  570. DUMP_STATIC_ARRAY (int32_arr0, "test_repeated_sfixed32_arr0");
  571. DUMP_STATIC_ARRAY (int32_arr1, "test_repeated_sfixed32_arr1");
  572. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_repeated_sfixed32_arr_min_max");
  573. #undef DUMP_STATIC_ARRAY
  574. }
  575. static void dump_test_repeated_fixed32 (void)
  576. {
  577. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  578. DUMP_STATIC_ARRAY_GENERIC(test_fixed32, static_array, output_array_name)
  579. DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_repeated_fixed32_roundnumbers");
  580. DUMP_STATIC_ARRAY (uint32_0_max, "test_repeated_fixed32_0_max");
  581. #undef DUMP_STATIC_ARRAY
  582. }
  583. static void dump_test_repeated_int64 (void)
  584. {
  585. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  586. DUMP_STATIC_ARRAY_GENERIC(test_int64, static_array, output_array_name)
  587. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_repeated_int64_roundnumbers");
  588. DUMP_STATIC_ARRAY (int64_min_max, "test_repeated_int64_min_max");
  589. #undef DUMP_STATIC_ARRAY
  590. }
  591. static void dump_test_repeated_sint64 (void)
  592. {
  593. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  594. DUMP_STATIC_ARRAY_GENERIC(test_sint64, static_array, output_array_name)
  595. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_repeated_sint64_roundnumbers");
  596. DUMP_STATIC_ARRAY (int64_min_max, "test_repeated_sint64_min_max");
  597. #undef DUMP_STATIC_ARRAY
  598. }
  599. static void dump_test_repeated_sfixed64 (void)
  600. {
  601. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  602. DUMP_STATIC_ARRAY_GENERIC(test_sfixed64, static_array, output_array_name)
  603. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_repeated_sfixed64_roundnumbers");
  604. DUMP_STATIC_ARRAY (int64_min_max, "test_repeated_sfixed64_min_max");
  605. #undef DUMP_STATIC_ARRAY
  606. }
  607. static void dump_test_repeated_uint64 (void)
  608. {
  609. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  610. DUMP_STATIC_ARRAY_GENERIC (test_uint64, static_array, output_array_name)
  611. DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_repeated_uint64_roundnumbers");
  612. DUMP_STATIC_ARRAY(uint64_0_1_max, "test_repeated_uint64_0_1_max");
  613. DUMP_STATIC_ARRAY(uint64_random, "test_repeated_uint64_random");
  614. #undef DUMP_STATIC_ARRAY
  615. }
  616. static void dump_test_repeated_fixed64 (void)
  617. {
  618. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  619. DUMP_STATIC_ARRAY_GENERIC(test_fixed64, static_array, output_array_name)
  620. DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_repeated_fixed64_roundnumbers");
  621. DUMP_STATIC_ARRAY(uint64_0_1_max, "test_repeated_fixed64_0_1_max");
  622. DUMP_STATIC_ARRAY(uint64_random, "test_repeated_fixed64_random");
  623. #undef DUMP_STATIC_ARRAY
  624. }
  625. static void dump_test_repeated_float (void)
  626. {
  627. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  628. DUMP_STATIC_ARRAY_GENERIC(test_float, static_array, output_array_name)
  629. DUMP_STATIC_ARRAY(float_random, "test_repeated_float_random");
  630. #undef DUMP_STATIC_ARRAY
  631. }
  632. static void dump_test_repeated_double (void)
  633. {
  634. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  635. DUMP_STATIC_ARRAY_GENERIC(test_double, static_array, output_array_name)
  636. DUMP_STATIC_ARRAY(double_random, "test_repeated_double_random");
  637. #undef DUMP_STATIC_ARRAY
  638. }
  639. static void dump_test_repeated_boolean (void)
  640. {
  641. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  642. DUMP_STATIC_ARRAY_GENERIC(test_boolean, static_array, output_array_name)
  643. DUMP_STATIC_ARRAY(boolean_0, "test_repeated_boolean_0");
  644. DUMP_STATIC_ARRAY(boolean_1, "test_repeated_boolean_1");
  645. DUMP_STATIC_ARRAY(boolean_random, "test_repeated_boolean_random");
  646. #undef DUMP_STATIC_ARRAY
  647. }
  648. static void dump_test_repeated_enum_small (void)
  649. {
  650. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  651. DUMP_STATIC_ARRAY_GENERIC (test_enum_small, static_array, output_array_name)
  652. DUMP_STATIC_ARRAY (enum_small_0, "test_repeated_enum_small_0");
  653. DUMP_STATIC_ARRAY (enum_small_1, "test_repeated_enum_small_1");
  654. DUMP_STATIC_ARRAY (enum_small_random, "test_repeated_enum_small_random");
  655. #undef DUMP_STATIC_ARRAY
  656. }
  657. static void dump_test_repeated_enum (void)
  658. {
  659. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  660. DUMP_STATIC_ARRAY_GENERIC (test_enum, static_array, output_array_name)
  661. DUMP_STATIC_ARRAY (enum_0, "test_repeated_enum_0");
  662. DUMP_STATIC_ARRAY (enum_1, "test_repeated_enum_1");
  663. DUMP_STATIC_ARRAY (enum_random, "test_repeated_enum_random");
  664. #undef DUMP_STATIC_ARRAY
  665. }
  666. static void dump_test_repeated_string (void)
  667. {
  668. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  669. DUMP_STATIC_ARRAY_GENERIC (test_string, static_array, output_array_name)
  670. DUMP_STATIC_ARRAY (repeated_strings_0, "test_repeated_strings_0");
  671. DUMP_STATIC_ARRAY (repeated_strings_1, "test_repeated_strings_1");
  672. DUMP_STATIC_ARRAY (repeated_strings_2, "test_repeated_strings_2");
  673. DUMP_STATIC_ARRAY (repeated_strings_3, "test_repeated_strings_3");
  674. #undef DUMP_STATIC_ARRAY
  675. }
  676. static void dump_test_repeated_bytes (void)
  677. {
  678. TestMess mess;
  679. mess.add_test_bytes(std::string("text"));
  680. mess.add_test_bytes(std::string("str\1\2\3\4\5") + '\0');
  681. mess.add_test_bytes(std::string("gobble") + '\0' + "foo");
  682. dump_message_bytes(&mess, "test_repeated_bytes_0");
  683. }
  684. static void dump_test_repeated_SubMess (void)
  685. {
  686. TestMess mess;
  687. mess.add_test_message()->set_test(0);
  688. mess.add_test_message()->set_test(0);
  689. mess.add_test_message()->set_test(0);
  690. dump_message_bytes(&mess, "test_repeated_submess_0");
  691. mess.clear_test_message();
  692. mess.add_test_message()->set_test(42);
  693. mess.add_test_message()->set_test(-10000);
  694. mess.add_test_message()->set_test(667);
  695. dump_message_bytes(&mess, "test_repeated_submess_1");
  696. }
  697. #undef DUMP_STATIC_ARRAY_GENERIC
  698. #define DUMP_STATIC_ARRAY_GENERIC(member, static_array, output_array_name) \
  699. do{ \
  700. TestMessPacked mess; \
  701. for (unsigned i = 0; i < N_ELEMENTS (static_array); i++) \
  702. mess.add_##member(static_array[i]); \
  703. dump_message_bytes(&mess, output_array_name); \
  704. }while(0)
  705. static void dump_test_packed_repeated_int32 (void)
  706. {
  707. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  708. DUMP_STATIC_ARRAY_GENERIC(test_int32, static_array, output_array_name)
  709. DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_int32_arr0");
  710. DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_int32_arr1");
  711. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_int32_arr_min_max");
  712. #undef DUMP_STATIC_ARRAY
  713. }
  714. static void dump_test_packed_repeated_sint32 (void)
  715. {
  716. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  717. DUMP_STATIC_ARRAY_GENERIC(test_sint32, static_array, output_array_name)
  718. DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_sint32_arr0");
  719. DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_sint32_arr1");
  720. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_sint32_arr_min_max");
  721. #undef DUMP_STATIC_ARRAY
  722. }
  723. static void dump_test_packed_repeated_uint32 (void)
  724. {
  725. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  726. DUMP_STATIC_ARRAY_GENERIC(test_uint32, static_array, output_array_name)
  727. DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_packed_repeated_uint32_roundnumbers");
  728. DUMP_STATIC_ARRAY (uint32_0_max, "test_packed_repeated_uint32_0_max");
  729. #undef DUMP_STATIC_ARRAY
  730. }
  731. static void dump_test_packed_repeated_sfixed32 (void)
  732. {
  733. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  734. DUMP_STATIC_ARRAY_GENERIC(test_sfixed32, static_array, output_array_name)
  735. DUMP_STATIC_ARRAY (int32_arr0, "test_packed_repeated_sfixed32_arr0");
  736. DUMP_STATIC_ARRAY (int32_arr1, "test_packed_repeated_sfixed32_arr1");
  737. DUMP_STATIC_ARRAY (int32_arr_min_max, "test_packed_repeated_sfixed32_arr_min_max");
  738. #undef DUMP_STATIC_ARRAY
  739. }
  740. static void dump_test_packed_repeated_fixed32 (void)
  741. {
  742. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  743. DUMP_STATIC_ARRAY_GENERIC(test_fixed32, static_array, output_array_name)
  744. DUMP_STATIC_ARRAY (uint32_roundnumbers, "test_packed_repeated_fixed32_roundnumbers");
  745. DUMP_STATIC_ARRAY (uint32_0_max, "test_packed_repeated_fixed32_0_max");
  746. #undef DUMP_STATIC_ARRAY
  747. }
  748. static void dump_test_packed_repeated_int64 (void)
  749. {
  750. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  751. DUMP_STATIC_ARRAY_GENERIC(test_int64, static_array, output_array_name)
  752. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_int64_roundnumbers");
  753. DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_int64_min_max");
  754. #undef DUMP_STATIC_ARRAY
  755. }
  756. static void dump_test_packed_repeated_sint64 (void)
  757. {
  758. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  759. DUMP_STATIC_ARRAY_GENERIC(test_sint64, static_array, output_array_name)
  760. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_sint64_roundnumbers");
  761. DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_sint64_min_max");
  762. #undef DUMP_STATIC_ARRAY
  763. }
  764. static void dump_test_packed_repeated_sfixed64 (void)
  765. {
  766. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  767. DUMP_STATIC_ARRAY_GENERIC(test_sfixed64, static_array, output_array_name)
  768. DUMP_STATIC_ARRAY (int64_roundnumbers, "test_packed_repeated_sfixed64_roundnumbers");
  769. DUMP_STATIC_ARRAY (int64_min_max, "test_packed_repeated_sfixed64_min_max");
  770. #undef DUMP_STATIC_ARRAY
  771. }
  772. static void dump_test_packed_repeated_uint64 (void)
  773. {
  774. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  775. DUMP_STATIC_ARRAY_GENERIC (test_uint64, static_array, output_array_name)
  776. DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_packed_repeated_uint64_roundnumbers");
  777. DUMP_STATIC_ARRAY(uint64_0_1_max, "test_packed_repeated_uint64_0_1_max");
  778. DUMP_STATIC_ARRAY(uint64_random, "test_packed_repeated_uint64_random");
  779. #undef DUMP_STATIC_ARRAY
  780. }
  781. static void dump_test_packed_repeated_fixed64 (void)
  782. {
  783. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  784. DUMP_STATIC_ARRAY_GENERIC(test_fixed64, static_array, output_array_name)
  785. DUMP_STATIC_ARRAY(uint64_roundnumbers, "test_packed_repeated_fixed64_roundnumbers");
  786. DUMP_STATIC_ARRAY(uint64_0_1_max, "test_packed_repeated_fixed64_0_1_max");
  787. DUMP_STATIC_ARRAY(uint64_random, "test_packed_repeated_fixed64_random");
  788. #undef DUMP_STATIC_ARRAY
  789. }
  790. static void dump_test_packed_repeated_float (void)
  791. {
  792. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  793. DUMP_STATIC_ARRAY_GENERIC(test_float, static_array, output_array_name)
  794. DUMP_STATIC_ARRAY(float_random, "test_packed_repeated_float_random");
  795. #undef DUMP_STATIC_ARRAY
  796. }
  797. static void dump_test_packed_repeated_double (void)
  798. {
  799. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  800. DUMP_STATIC_ARRAY_GENERIC(test_double, static_array, output_array_name)
  801. DUMP_STATIC_ARRAY(double_random, "test_packed_repeated_double_random");
  802. #undef DUMP_STATIC_ARRAY
  803. }
  804. static void dump_test_packed_repeated_boolean (void)
  805. {
  806. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  807. DUMP_STATIC_ARRAY_GENERIC(test_boolean, static_array, output_array_name)
  808. DUMP_STATIC_ARRAY(boolean_0, "test_packed_repeated_boolean_0");
  809. DUMP_STATIC_ARRAY(boolean_1, "test_packed_repeated_boolean_1");
  810. DUMP_STATIC_ARRAY(boolean_random, "test_packed_repeated_boolean_random");
  811. #undef DUMP_STATIC_ARRAY
  812. }
  813. static void dump_test_packed_repeated_enum_small (void)
  814. {
  815. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  816. DUMP_STATIC_ARRAY_GENERIC (test_enum_small, static_array, output_array_name)
  817. DUMP_STATIC_ARRAY (enum_small_0, "test_packed_repeated_enum_small_0");
  818. DUMP_STATIC_ARRAY (enum_small_1, "test_packed_repeated_enum_small_1");
  819. DUMP_STATIC_ARRAY (enum_small_random, "test_packed_repeated_enum_small_random");
  820. #undef DUMP_STATIC_ARRAY
  821. }
  822. static void dump_test_packed_repeated_enum (void)
  823. {
  824. #define DUMP_STATIC_ARRAY(static_array, output_array_name) \
  825. DUMP_STATIC_ARRAY_GENERIC (test_enum, static_array, output_array_name)
  826. DUMP_STATIC_ARRAY (enum_0, "test_packed_repeated_enum_0");
  827. DUMP_STATIC_ARRAY (enum_1, "test_packed_repeated_enum_1");
  828. DUMP_STATIC_ARRAY (enum_random, "test_packed_repeated_enum_random");
  829. #undef DUMP_STATIC_ARRAY
  830. }
  831. static void dump_test_unknown_fields (void)
  832. {
  833. EmptyMess mess;
  834. const google::protobuf::Message::Reflection *reflection = mess.GetReflection();
  835. google::protobuf::UnknownFieldSet *fs = reflection->MutableUnknownFields(&mess);
  836. #if GOOGLE_PROTOBUF_VERSION >= 2001000
  837. fs->AddVarint(5454, 255);
  838. fs->AddFixed32(5555, 260);
  839. #else
  840. google::protobuf::UnknownField *f;
  841. f = fs->AddField(5454);
  842. f->add_varint(255);
  843. f = fs->AddField(5555);
  844. f->add_fixed32(260);
  845. #endif
  846. dump_message_bytes (&mess, "test_unknown_fields_0");
  847. fs->Clear();
  848. #if GOOGLE_PROTOBUF_VERSION >= 2001000
  849. fs->AddLengthDelimited(6666, "xxxxxxxx");
  850. fs->AddFixed64(7777, 0x10101);
  851. #else
  852. f = fs->AddField(6666);
  853. f->add_length_delimited("xxxxxxxx");
  854. f = fs->AddField(7777);
  855. f->add_fixed64(0x10101);
  856. #endif
  857. dump_message_bytes (&mess, "test_unknown_fields_1");
  858. }
  859. int main()
  860. {
  861. dump_test_enum_small ();
  862. dump_test_enum_big ();
  863. dump_test_field_numbers ();
  864. dump_test_required_int32 ();
  865. dump_test_required_sint32 ();
  866. dump_test_required_sfixed32 ();
  867. dump_test_required_uint32 ();
  868. dump_test_required_fixed32 ();
  869. dump_test_required_int64 ();
  870. dump_test_required_sint64 ();
  871. dump_test_required_sfixed64 ();
  872. dump_test_required_uint64 ();
  873. dump_test_required_fixed64 ();
  874. dump_test_required_float ();
  875. dump_test_required_double ();
  876. dump_test_required_bool ();
  877. dump_test_required_enum_small ();
  878. dump_test_required_enum ();
  879. dump_test_required_string ();
  880. dump_test_required_bytes ();
  881. dump_test_required_message ();
  882. dump_test_optional_int32 ();
  883. dump_test_optional_sint32 ();
  884. dump_test_optional_sfixed32 ();
  885. dump_test_optional_int64 ();
  886. dump_test_optional_sint64 ();
  887. dump_test_optional_sfixed64 ();
  888. dump_test_optional_uint32 ();
  889. dump_test_optional_fixed32 ();
  890. dump_test_optional_uint64 ();
  891. dump_test_optional_fixed64 ();
  892. dump_test_optional_float ();
  893. dump_test_optional_double ();
  894. dump_test_optional_bool ();
  895. dump_test_optional_enum_small ();
  896. dump_test_optional_enum ();
  897. dump_test_optional_string ();
  898. dump_test_optional_bytes ();
  899. dump_test_optional_message ();
  900. dump_test_repeated_int32 ();
  901. dump_test_repeated_sint32 ();
  902. dump_test_repeated_uint32 ();
  903. dump_test_repeated_sfixed32 ();
  904. dump_test_repeated_fixed32 ();
  905. dump_test_repeated_int64 ();
  906. dump_test_repeated_sint64 ();
  907. dump_test_repeated_sfixed64 ();
  908. dump_test_repeated_uint64 ();
  909. dump_test_repeated_fixed64 ();
  910. dump_test_repeated_float ();
  911. dump_test_repeated_double ();
  912. dump_test_repeated_boolean ();
  913. dump_test_repeated_enum_small ();
  914. dump_test_repeated_enum ();
  915. dump_test_repeated_string ();
  916. dump_test_repeated_bytes ();
  917. dump_test_repeated_SubMess ();
  918. dump_test_packed_repeated_int32 ();
  919. dump_test_packed_repeated_sint32 ();
  920. dump_test_packed_repeated_uint32 ();
  921. dump_test_packed_repeated_sfixed32 ();
  922. dump_test_packed_repeated_fixed32 ();
  923. dump_test_packed_repeated_int64 ();
  924. dump_test_packed_repeated_sint64 ();
  925. dump_test_packed_repeated_sfixed64 ();
  926. dump_test_packed_repeated_uint64 ();
  927. dump_test_packed_repeated_fixed64 ();
  928. dump_test_packed_repeated_float ();
  929. dump_test_packed_repeated_double ();
  930. dump_test_packed_repeated_boolean ();
  931. dump_test_packed_repeated_enum_small ();
  932. dump_test_packed_repeated_enum ();
  933. dump_test_unknown_fields ();
  934. return 0;
  935. }