lite_unittest.cc
Go to the documentation of this file.
1 // Protocol Buffers - Google's data interchange format
2 // Copyright 2008 Google Inc. All rights reserved.
3 // https://developers.google.com/protocol-buffers/
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are
7 // met:
8 //
9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer.
11 // * Redistributions in binary form must reproduce the above
12 // copyright notice, this list of conditions and the following disclaimer
13 // in the documentation and/or other materials provided with the
14 // distribution.
15 // * Neither the name of Google Inc. nor the names of its
16 // contributors may be used to endorse or promote products derived from
17 // this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // Author: kenton@google.com (Kenton Varda)
32 
33 #include <iostream>
34 #include <string>
35 
40 #include <google/protobuf/map_lite_unittest.pb.h>
42 #include <google/protobuf/unittest_lite.pb.h>
46 #include <gtest/gtest.h>
48 
49 namespace google {
50 namespace protobuf {
51 
52 // Helper methods to test parsing merge behavior.
53 void ExpectMessageMerged(const unittest::TestAllTypesLite& message) {
54  EXPECT_EQ(message.optional_int32(), 3);
55  EXPECT_EQ(message.optional_int64(), 2);
56  EXPECT_EQ(message.optional_string(), "hello");
57 }
58 
59 void AssignParsingMergeMessages(unittest::TestAllTypesLite* msg1,
60  unittest::TestAllTypesLite* msg2,
61  unittest::TestAllTypesLite* msg3) {
62  msg1->set_optional_int32(1);
63  msg2->set_optional_int64(2);
64  msg3->set_optional_int32(3);
65  msg3->set_optional_string("hello");
66 }
67 
69  unittest::TestEmptyMessageLite* empty_message) {
70  protobuf_unittest::TestAllTypesLite message;
73  std::string data = message.SerializeAsString();
74  empty_message->ParseFromString(data);
75 }
76 
78  unittest::TestEmptyMessageLite* empty_message) {
79  protobuf_unittest::TestAllTypesLite message;
81  message.set_optional_int32(101);
82  message.set_optional_int64(102);
83  message.set_optional_uint32(103);
84  message.set_optional_uint64(104);
85  std::string data = message.SerializeAsString();
86  empty_message->ParseFromString(data);
87 }
88 
89 TEST(Lite, AllLite1) {
91 
92  {
93  protobuf_unittest::TestAllTypesLite message, message2, message3;
96  message2.CopyFrom(message);
97  data = message.SerializeAsString();
98  message3.ParseFromString(data);
104  message.Clear();
106  }
107 }
108 
109 TEST(Lite, AllLite2) {
111  {
112  protobuf_unittest::TestAllExtensionsLite message, message2, message3;
115  message2.CopyFrom(message);
116  std::string extensions_data = message.SerializeAsString();
117  message3.ParseFromString(extensions_data);
123  message.Clear();
125  }
126 }
127 
128 TEST(Lite, AllLite3) {
129  std::string data, packed_data;
130 
131  {
132  protobuf_unittest::TestPackedTypesLite message, message2, message3;
135  message2.CopyFrom(message);
136  packed_data = message.SerializeAsString();
137  message3.ParseFromString(packed_data);
143  message.Clear();
145  }
146 
147  {
148  protobuf_unittest::TestPackedExtensionsLite message, message2, message3;
151  message2.CopyFrom(message);
152  std::string packed_extensions_data = message.SerializeAsString();
153  EXPECT_EQ(packed_extensions_data, packed_data);
154  message3.ParseFromString(packed_extensions_data);
160  message.Clear();
162  }
163 }
164 
165 TEST(Lite, AllLite5) {
167 
168  {
169  // Test that if an optional or required message/group field appears multiple
170  // times in the input, they need to be merged.
171  unittest::TestParsingMergeLite::RepeatedFieldsGenerator generator;
172  unittest::TestAllTypesLite* msg1;
173  unittest::TestAllTypesLite* msg2;
174  unittest::TestAllTypesLite* msg3;
175 
176 #define ASSIGN_REPEATED_FIELD(FIELD) \
177  msg1 = generator.add_##FIELD(); \
178  msg2 = generator.add_##FIELD(); \
179  msg3 = generator.add_##FIELD(); \
180  AssignParsingMergeMessages(msg1, msg2, msg3)
181 
182  ASSIGN_REPEATED_FIELD(field1);
183  ASSIGN_REPEATED_FIELD(field2);
184  ASSIGN_REPEATED_FIELD(field3);
185  ASSIGN_REPEATED_FIELD(ext1);
186  ASSIGN_REPEATED_FIELD(ext2);
187 
188 #undef ASSIGN_REPEATED_FIELD
189 #define ASSIGN_REPEATED_GROUP(FIELD) \
190  msg1 = generator.add_##FIELD()->mutable_field1(); \
191  msg2 = generator.add_##FIELD()->mutable_field1(); \
192  msg3 = generator.add_##FIELD()->mutable_field1(); \
193  AssignParsingMergeMessages(msg1, msg2, msg3)
194 
195  ASSIGN_REPEATED_GROUP(group1);
196  ASSIGN_REPEATED_GROUP(group2);
197 
198 #undef ASSIGN_REPEATED_GROUP
199 
201  generator.SerializeToString(&buffer);
202  unittest::TestParsingMergeLite parsing_merge;
203  parsing_merge.ParseFromString(buffer);
204 
205  // Required and optional fields should be merged.
206  ExpectMessageMerged(parsing_merge.required_all_types());
207  ExpectMessageMerged(parsing_merge.optional_all_types());
209  parsing_merge.optionalgroup().optional_group_all_types());
210  ExpectMessageMerged(parsing_merge.GetExtension(
211  unittest::TestParsingMergeLite::optional_ext));
212 
213  // Repeated fields should not be merged.
214  EXPECT_EQ(parsing_merge.repeated_all_types_size(), 3);
215  EXPECT_EQ(parsing_merge.repeatedgroup_size(), 3);
216  EXPECT_EQ(parsing_merge.ExtensionSize(
217  unittest::TestParsingMergeLite::repeated_ext),
218  3);
219  }
220 }
221 
222 TEST(Lite, AllLite6) {
224 
225  // Test unknown fields support for lite messages.
226  {
227  protobuf_unittest::TestAllTypesLite message, message2;
228  protobuf_unittest::TestEmptyMessageLite empty_message;
231  data = message.SerializeAsString();
232  ASSERT_TRUE(empty_message.ParseFromString(data));
233  data.clear();
234  data = empty_message.SerializeAsString();
235  EXPECT_TRUE(message2.ParseFromString(data));
236  data = message2.SerializeAsString();
238  message.Clear();
240  }
241 }
242 
243 TEST(Lite, AllLite7) {
245 
246  {
247  protobuf_unittest::TestAllExtensionsLite message, message2;
248  protobuf_unittest::TestEmptyMessageLite empty_message;
251  data = message.SerializeAsString();
252  empty_message.ParseFromString(data);
253  data.clear();
254  data = empty_message.SerializeAsString();
255  message2.ParseFromString(data);
256  data = message2.SerializeAsString();
258  message.Clear();
260  }
261 }
262 
263 TEST(Lite, AllLite8) {
265 
266  {
267  protobuf_unittest::TestPackedTypesLite message, message2;
268  protobuf_unittest::TestEmptyMessageLite empty_message;
271  data = message.SerializeAsString();
272  empty_message.ParseFromString(data);
273  data.clear();
274  data = empty_message.SerializeAsString();
275  message2.ParseFromString(data);
276  data = message2.SerializeAsString();
278  message.Clear();
280  }
281 }
282 
283 TEST(Lite, AllLite9) {
285 
286  {
287  protobuf_unittest::TestPackedExtensionsLite message, message2;
288  protobuf_unittest::TestEmptyMessageLite empty_message;
291  data = message.SerializeAsString();
292  empty_message.ParseFromString(data);
293  data.clear();
294  data = empty_message.SerializeAsString();
295  message2.ParseFromString(data);
296  data = message2.SerializeAsString();
298  message.Clear();
300  }
301 }
302 
303 TEST(Lite, AllLite10) {
305 
306  {
307  // Test Unknown fields swap
308  protobuf_unittest::TestEmptyMessageLite empty_message, empty_message2;
311  data = empty_message.SerializeAsString();
312  std::string data2 = empty_message2.SerializeAsString();
313  empty_message.Swap(&empty_message2);
314  EXPECT_EQ(data, empty_message2.SerializeAsString());
315  EXPECT_EQ(data2, empty_message.SerializeAsString());
316  }
317 }
318 
319 TEST(Lite, AllLite11) {
321 
322  {
323  // Test unknown fields swap with self
324  protobuf_unittest::TestEmptyMessageLite empty_message;
326  data = empty_message.SerializeAsString();
327  empty_message.Swap(&empty_message);
328  EXPECT_EQ(data, empty_message.SerializeAsString());
329  }
330 }
331 
332 TEST(Lite, AllLite12) {
334 
335  {
336  // Test MergeFrom with unknown fields
337  protobuf_unittest::TestAllTypesLite message, message2;
338  protobuf_unittest::TestEmptyMessageLite empty_message, empty_message2;
339  message.set_optional_int32(101);
340  message.add_repeated_int32(201);
341  message.set_optional_nested_enum(unittest::TestAllTypesLite::BAZ);
342  message2.set_optional_int64(102);
343  message2.add_repeated_int64(202);
344  message2.set_optional_foreign_enum(unittest::FOREIGN_LITE_BAZ);
345 
346  data = message.SerializeAsString();
347  empty_message.ParseFromString(data);
348  data = message2.SerializeAsString();
349  empty_message2.ParseFromString(data);
350  message.MergeFrom(message2);
351  empty_message.MergeFrom(empty_message2);
352 
353  data = empty_message.SerializeAsString();
354  message2.ParseFromString(data);
355  // We do not compare the serialized output of a normal message and a lite
356  // message because the order of fields do not match. We convert lite message
357  // back into normal message, then compare.
358  EXPECT_EQ(message.SerializeAsString(), message2.SerializeAsString());
359  }
360 }
361 
362 TEST(Lite, AllLite13) {
364 
365  {
366  // Test unknown enum value
367  protobuf_unittest::TestAllTypesLite message;
369  {
370  io::StringOutputStream output_stream(&buffer);
371  io::CodedOutputStream coded_output(&output_stream);
373  protobuf_unittest::TestAllTypesLite::kOptionalNestedEnumFieldNumber,
375  coded_output.WriteVarint32(10);
377  protobuf_unittest::TestAllTypesLite::kRepeatedNestedEnumFieldNumber,
379  coded_output.WriteVarint32(20);
380  }
381  message.ParseFromString(buffer);
382  data = message.SerializeAsString();
384  }
385 }
386 
387 TEST(Lite, AllLite14) {
389 
390  {
391  // Test Clear with unknown fields
392  protobuf_unittest::TestEmptyMessageLite empty_message;
394  empty_message.Clear();
395  EXPECT_EQ(0, empty_message.unknown_fields().size());
396  }
397 }
398 
399 // Tests for map lite =============================================
400 
401 TEST(Lite, AllLite15) {
403 
404  {
405  // Accessors
406  protobuf_unittest::TestMapLite message;
407 
410 
413  }
414 }
415 
416 TEST(Lite, AllLite16) {
418 
419  {
420  // SetMapFieldsInitialized
421  protobuf_unittest::TestMapLite message;
422 
425  }
426 }
427 
428 TEST(Lite, AllLite17) {
430 
431  {
432  // Clear
433  protobuf_unittest::TestMapLite message;
434 
436  message.Clear();
438  }
439 }
440 
441 TEST(Lite, AllLite18) {
443 
444  {
445  // ClearMessageMap
446  protobuf_unittest::TestMessageMapLite message;
447 
448  // Creates a TestAllTypes with default value
449  TestUtilLite::ExpectClear((*message.mutable_map_int32_message())[0]);
450  }
451 }
452 
453 TEST(Lite, AllLite19) {
455 
456  {
457  // CopyFrom
458  protobuf_unittest::TestMapLite message1, message2;
459 
461  message2.CopyFrom(message1);
463 
464  // Copying from self should be a no-op.
465  message2.CopyFrom(message2);
467  }
468 }
469 
470 TEST(Lite, AllLite20) {
472 
473  {
474  // CopyFromMessageMap
475  protobuf_unittest::TestMessageMapLite message1, message2;
476 
477  (*message1.mutable_map_int32_message())[0].add_repeated_int32(100);
478  (*message2.mutable_map_int32_message())[0].add_repeated_int32(101);
479 
480  message1.CopyFrom(message2);
481 
482  // Checks repeated field is overwritten.
483  EXPECT_EQ(1, message1.map_int32_message().at(0).repeated_int32_size());
484  EXPECT_EQ(101, message1.map_int32_message().at(0).repeated_int32(0));
485  }
486 }
487 
488 TEST(Lite, AllLite21) {
490 
491  {
492  // SwapWithEmpty
493  protobuf_unittest::TestMapLite message1, message2;
494 
498 
499  message1.Swap(&message2);
502  }
503 }
504 
505 TEST(Lite, AllLite22) {
507 
508  {
509  // SwapWithSelf
510  protobuf_unittest::TestMapLite message;
511 
514 
515  message.Swap(&message);
517  }
518 }
519 
520 TEST(Lite, AllLite23) {
522 
523  {
524  // SwapWithOther
525  protobuf_unittest::TestMapLite message1, message2;
526 
530 
531  message1.Swap(&message2);
534  }
535 }
536 
537 TEST(Lite, AllLite24) {
539 
540  {
541  // CopyConstructor
542  protobuf_unittest::TestMapLite message1;
544 
545  protobuf_unittest::TestMapLite message2(message1);
547  }
548 }
549 
550 TEST(Lite, AllLite25) {
552 
553  {
554  // CopyAssignmentOperator
555  protobuf_unittest::TestMapLite message1;
557 
558  protobuf_unittest::TestMapLite message2;
559  message2 = message1;
561 
562  // Make sure that self-assignment does something sane.
563  message2.operator=(message2);
565  }
566 }
567 
568 TEST(Lite, AllLite26) {
570 
571  {
572  // NonEmptyMergeFrom
573  protobuf_unittest::TestMapLite message1, message2;
574 
576 
577  // This field will test merging into an empty spot.
578  (*message2.mutable_map_int32_int32())[1] = 1;
579  message1.mutable_map_int32_int32()->erase(1);
580 
581  // This tests overwriting.
582  (*message2.mutable_map_int32_double())[1] = 1;
583  (*message1.mutable_map_int32_double())[1] = 2;
584 
585  message1.MergeFrom(message2);
587  }
588 }
589 
590 TEST(Lite, AllLite27) {
592 
593  {
594  // MergeFromMessageMap
595  protobuf_unittest::TestMessageMapLite message1, message2;
596 
597  (*message1.mutable_map_int32_message())[0].add_repeated_int32(100);
598  (*message2.mutable_map_int32_message())[0].add_repeated_int32(101);
599 
600  message1.MergeFrom(message2);
601 
602  // Checks repeated field is overwritten.
603  EXPECT_EQ(1, message1.map_int32_message().at(0).repeated_int32_size());
604  EXPECT_EQ(101, message1.map_int32_message().at(0).repeated_int32(0));
605  }
606 }
607 
608 TEST(Lite, AllLite28) {
610 
611  {
612  // Test the generated SerializeWithCachedSizesToArray()
613  protobuf_unittest::TestMapLite message1, message2;
616  int size = message1.ByteSize();
617  data.resize(size);
619  ::google::protobuf::uint8* end = message1.SerializeWithCachedSizesToArray(start);
620  EXPECT_EQ(size, end - start);
621  EXPECT_TRUE(message2.ParseFromString(data));
623  }
624 }
625 
626 TEST(Lite, AllLite29) {
628 
629  {
630  // Test the generated SerializeWithCachedSizes()
631  protobuf_unittest::TestMapLite message1, message2;
633  int size = message1.ByteSize();
635  data.resize(size);
636  {
637  // Allow the output stream to buffer only one byte at a time.
639  io::CodedOutputStream output_stream(&array_stream);
640  message1.SerializeWithCachedSizes(&output_stream);
641  EXPECT_FALSE(output_stream.HadError());
642  EXPECT_EQ(size, output_stream.ByteCount());
643  }
644  EXPECT_TRUE(message2.ParseFromString(data));
646  }
647 }
648 
649 
650 TEST(Lite, AllLite32) {
652 
653  {
654  // Proto2UnknownEnum
655  protobuf_unittest::TestEnumMapPlusExtraLite from;
656  (*from.mutable_known_map_field())[0] =
657  protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE;
658  (*from.mutable_unknown_map_field())[0] =
659  protobuf_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE;
661  from.SerializeToString(&data);
662 
663  protobuf_unittest::TestEnumMapLite to;
664  EXPECT_TRUE(to.ParseFromString(data));
665  EXPECT_EQ(0, to.unknown_map_field().size());
666  EXPECT_FALSE(to.mutable_unknown_fields()->empty());
667  ASSERT_EQ(1, to.known_map_field().size());
668  EXPECT_EQ(protobuf_unittest::PROTO2_MAP_ENUM_FOO_LITE,
669  to.known_map_field().at(0));
670 
671  data.clear();
672  from.Clear();
673  to.SerializeToString(&data);
674  EXPECT_TRUE(from.ParseFromString(data));
675  ASSERT_EQ(1, from.known_map_field().size());
676  EXPECT_EQ(protobuf_unittest::E_PROTO2_MAP_ENUM_FOO_LITE,
677  from.known_map_field().at(0));
678  ASSERT_EQ(1, from.unknown_map_field().size());
679  EXPECT_EQ(protobuf_unittest::E_PROTO2_MAP_ENUM_EXTRA_LITE,
680  from.unknown_map_field().at(0));
681  }
682 }
683 
684 TEST(Lite, AllLite33) {
686 
687  {
688  // StandardWireFormat
689  protobuf_unittest::TestMapLite message;
690  std::string data = "\x0A\x04\x08\x01\x10\x01";
691 
692  EXPECT_TRUE(message.ParseFromString(data));
693  ASSERT_EQ(1, message.map_int32_int32().size());
694  EXPECT_EQ(1, message.map_int32_int32().at(1));
695  }
696 }
697 
698 TEST(Lite, AllLite34) {
700 
701  {
702  // UnorderedWireFormat
703  protobuf_unittest::TestMapLite message;
704 
705  // put value before key in wire format
706  std::string data = "\x0A\x04\x10\x01\x08\x02";
707 
708  EXPECT_TRUE(message.ParseFromString(data));
709  ASSERT_EQ(1, message.map_int32_int32().size());
710  ASSERT_NE(message.map_int32_int32().find(2),
711  message.map_int32_int32().end());
712  EXPECT_EQ(1, message.map_int32_int32().at(2));
713  }
714 }
715 
716 TEST(Lite, AllLite35) {
718 
719  {
720  // DuplicatedKeyWireFormat
721  protobuf_unittest::TestMapLite message;
722 
723  // Two key fields in wire format
724  std::string data = "\x0A\x06\x08\x01\x08\x02\x10\x01";
725 
726  EXPECT_TRUE(message.ParseFromString(data));
727  ASSERT_EQ(1, message.map_int32_int32().size());
728  EXPECT_EQ(1, message.map_int32_int32().at(2));
729  }
730 }
731 
732 TEST(Lite, AllLite36) {
734 
735  {
736  // DuplicatedValueWireFormat
737  protobuf_unittest::TestMapLite message;
738 
739  // Two value fields in wire format
740  std::string data = "\x0A\x06\x08\x01\x10\x01\x10\x02";
741 
742  EXPECT_TRUE(message.ParseFromString(data));
743  ASSERT_EQ(1, message.map_int32_int32().size());
744  EXPECT_EQ(2, message.map_int32_int32().at(1));
745  }
746 }
747 
748 TEST(Lite, AllLite37) {
750 
751  {
752  // MissedKeyWireFormat
753  protobuf_unittest::TestMapLite message;
754 
755  // No key field in wire format
756  std::string data = "\x0A\x02\x10\x01";
757 
758  EXPECT_TRUE(message.ParseFromString(data));
759  ASSERT_EQ(1, message.map_int32_int32().size());
760  ASSERT_NE(message.map_int32_int32().find(0),
761  message.map_int32_int32().end());
762  EXPECT_EQ(1, message.map_int32_int32().at(0));
763  }
764 }
765 
766 TEST(Lite, AllLite38) {
768 
769  {
770  // MissedValueWireFormat
771  protobuf_unittest::TestMapLite message;
772 
773  // No value field in wire format
774  std::string data = "\x0A\x02\x08\x01";
775 
776  EXPECT_TRUE(message.ParseFromString(data));
777  ASSERT_EQ(1, message.map_int32_int32().size());
778  ASSERT_NE(message.map_int32_int32().find(1),
779  message.map_int32_int32().end());
780  EXPECT_EQ(0, message.map_int32_int32().at(1));
781  }
782 }
783 
784 TEST(Lite, AllLite39) {
786 
787  {
788  // UnknownFieldWireFormat
789  protobuf_unittest::TestMapLite message;
790 
791  // Unknown field in wire format
792  std::string data = "\x0A\x06\x08\x02\x10\x03\x18\x01";
793 
794  EXPECT_TRUE(message.ParseFromString(data));
795  ASSERT_EQ(1, message.map_int32_int32().size());
796  EXPECT_EQ(3, message.map_int32_int32().at(2));
797  }
798 }
799 
800 TEST(Lite, AllLite40) {
802 
803  {
804  // CorruptedWireFormat
805  protobuf_unittest::TestMapLite message;
806 
807  // corrupted data in wire format
808  std::string data = "\x0A\x06\x08\x02\x11\x03";
809 
810  EXPECT_FALSE(message.ParseFromString(data));
811  }
812 }
813 
814 TEST(Lite, AllLite41) {
816 
817  {
818  // IsInitialized
819  protobuf_unittest::TestRequiredMessageMapLite map_message;
820 
821  // Add an uninitialized message.
822  (*map_message.mutable_map_field())[0];
823  EXPECT_FALSE(map_message.IsInitialized());
824 
825  // Initialize uninitialized message
826  (*map_message.mutable_map_field())[0].set_a(0);
827  (*map_message.mutable_map_field())[0].set_b(0);
828  (*map_message.mutable_map_field())[0].set_c(0);
829  EXPECT_TRUE(map_message.IsInitialized());
830  }
831 }
832 
833 TEST(Lite, AllLite42) {
835 
836  {
837  // Check that adding more values to enum does not corrupt message
838  // when passed through an old client.
839  protobuf_unittest::V2MessageLite v2_message;
840  v2_message.set_int_field(800);
841  // Set enum field to the value not understood by the old client.
842  v2_message.set_enum_field(protobuf_unittest::V2_SECOND);
843  std::string v2_bytes = v2_message.SerializeAsString();
844 
845  protobuf_unittest::V1MessageLite v1_message;
846  v1_message.ParseFromString(v2_bytes);
847  EXPECT_TRUE(v1_message.IsInitialized());
848  EXPECT_EQ(v1_message.int_field(), v2_message.int_field());
849  // V1 client does not understand V2_SECOND value, so it discards it and
850  // uses default value instead.
851  EXPECT_EQ(v1_message.enum_field(), protobuf_unittest::V1_FIRST);
852 
853  // However, when re-serialized, it should preserve enum value.
854  std::string v1_bytes = v1_message.SerializeAsString();
855 
856  protobuf_unittest::V2MessageLite same_v2_message;
857  same_v2_message.ParseFromString(v1_bytes);
858 
859  EXPECT_EQ(v2_message.int_field(), same_v2_message.int_field());
860  EXPECT_EQ(v2_message.enum_field(), same_v2_message.enum_field());
861  }
862 }
863 
864 // Test that when parsing a oneof, we can successfully clear whatever already
865 // happened to be stored in the oneof.
866 TEST(Lite, AllLite43) {
867  protobuf_unittest::TestOneofParsingLite message1;
868 
869  message1.set_oneof_int32(17);
870  std::string serialized;
871  EXPECT_TRUE(message1.SerializeToString(&serialized));
872 
873  // Submessage
874  {
875  protobuf_unittest::TestOneofParsingLite message2;
876  message2.mutable_oneof_submessage();
877  io::CodedInputStream input_stream(
878  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()), serialized.size());
879  EXPECT_TRUE(message2.MergeFromCodedStream(&input_stream));
880  EXPECT_EQ(17, message2.oneof_int32());
881  }
882 
883  // String
884  {
885  protobuf_unittest::TestOneofParsingLite message2;
886  message2.set_oneof_string("string");
887  io::CodedInputStream input_stream(
888  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()), serialized.size());
889  EXPECT_TRUE(message2.MergeFromCodedStream(&input_stream));
890  EXPECT_EQ(17, message2.oneof_int32());
891  }
892 
893  // Bytes
894  {
895  protobuf_unittest::TestOneofParsingLite message2;
896  message2.set_oneof_bytes("bytes");
897  io::CodedInputStream input_stream(
898  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()), serialized.size());
899  EXPECT_TRUE(message2.MergeFromCodedStream(&input_stream));
900  EXPECT_EQ(17, message2.oneof_int32());
901  }
902 }
903 
904 // Verify that we can successfully parse fields of various types within oneof
905 // fields. We also verify that we can parse the same data twice into the same
906 // message.
907 TEST(Lite, AllLite44) {
908  // Int32
909  {
910  protobuf_unittest::TestOneofParsingLite original;
911  original.set_oneof_int32(17);
912  std::string serialized;
913  EXPECT_TRUE(original.SerializeToString(&serialized));
914  protobuf_unittest::TestOneofParsingLite parsed;
915  for (int i = 0; i < 2; ++i) {
916  io::CodedInputStream input_stream(
917  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()),
918  serialized.size());
919  EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream));
920  EXPECT_EQ(17, parsed.oneof_int32());
921  }
922  }
923 
924  // Submessage
925  {
926  protobuf_unittest::TestOneofParsingLite original;
927  original.mutable_oneof_submessage()->set_optional_int32(5);
928  std::string serialized;
929  EXPECT_TRUE(original.SerializeToString(&serialized));
930  protobuf_unittest::TestOneofParsingLite parsed;
931  for (int i = 0; i < 2; ++i) {
932  io::CodedInputStream input_stream(
933  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()),
934  serialized.size());
935  EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream));
936  EXPECT_EQ(5, parsed.oneof_submessage().optional_int32());
937  }
938  }
939 
940  // String
941  {
942  protobuf_unittest::TestOneofParsingLite original;
943  original.set_oneof_string("string");
944  std::string serialized;
945  EXPECT_TRUE(original.SerializeToString(&serialized));
946  protobuf_unittest::TestOneofParsingLite parsed;
947  for (int i = 0; i < 2; ++i) {
948  io::CodedInputStream input_stream(
949  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()),
950  serialized.size());
951  EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream));
952  EXPECT_EQ("string", parsed.oneof_string());
953  }
954  }
955 
956  // Bytes
957  {
958  protobuf_unittest::TestOneofParsingLite original;
959  original.set_oneof_bytes("bytes");
960  std::string serialized;
961  EXPECT_TRUE(original.SerializeToString(&serialized));
962  protobuf_unittest::TestOneofParsingLite parsed;
963  for (int i = 0; i < 2; ++i) {
964  io::CodedInputStream input_stream(
965  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()),
966  serialized.size());
967  EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream));
968  EXPECT_EQ("bytes", parsed.oneof_bytes());
969  }
970  }
971 
972  // Enum
973  {
974  protobuf_unittest::TestOneofParsingLite original;
975  original.set_oneof_enum(protobuf_unittest::V2_SECOND);
976  std::string serialized;
977  EXPECT_TRUE(original.SerializeToString(&serialized));
978  protobuf_unittest::TestOneofParsingLite parsed;
979  for (int i = 0; i < 2; ++i) {
980  io::CodedInputStream input_stream(
981  reinterpret_cast<const ::google::protobuf::uint8*>(serialized.data()),
982  serialized.size());
983  EXPECT_TRUE(parsed.MergeFromCodedStream(&input_stream));
984  EXPECT_EQ(protobuf_unittest::V2_SECOND, parsed.oneof_enum());
985  }
986  }
987 
988  std::cout << "PASS" << std::endl;
989 }
990 
991 TEST(Lite, AllLite45) {
992  // Test unknown fields are not discarded upon parsing.
993  std::string data = "\20\1"; // varint 1 with field number 2
994 
995  protobuf_unittest::ForeignMessageLite a;
996  EXPECT_TRUE(a.ParseFromString(data));
997  io::CodedInputStream input_stream(
998  reinterpret_cast<const ::google::protobuf::uint8*>(data.data()), data.size());
999  EXPECT_TRUE(a.MergePartialFromCodedStream(&input_stream));
1000 
1001  std::string serialized = a.SerializeAsString();
1002  EXPECT_EQ(serialized.substr(0, 2), data);
1003  EXPECT_EQ(serialized.substr(2), data);
1004 }
1005 
1006 // The following two tests check for wire compatibility between packed and
1007 // unpacked repeated fields. There used to be a bug in the generated parsing
1008 // code that caused us to calculate the highest possible tag number without
1009 // taking into account that a repeated field might not be in the packed (or
1010 // unpacked) state we expect. These tests specifically check for that issue by
1011 // making sure we can parse repeated fields when the tag is higher than we would
1012 // expect.
1013 TEST(Lite, AllLite46) {
1014  protobuf_unittest::PackedInt32 packed;
1015  packed.add_repeated_int32(42);
1016  std::string serialized;
1017  ASSERT_TRUE(packed.SerializeToString(&serialized));
1018 
1019  protobuf_unittest::NonPackedInt32 non_packed;
1020  ASSERT_TRUE(non_packed.ParseFromString(serialized));
1021  ASSERT_EQ(1, non_packed.repeated_int32_size());
1022  EXPECT_EQ(42, non_packed.repeated_int32(0));
1023 }
1024 
1025 TEST(Lite, AllLite47) {
1026  protobuf_unittest::NonPackedFixed32 non_packed;
1027  non_packed.add_repeated_fixed32(42);
1028  std::string serialized;
1029  ASSERT_TRUE(non_packed.SerializeToString(&serialized));
1030 
1031  protobuf_unittest::PackedFixed32 packed;
1032  ASSERT_TRUE(packed.ParseFromString(serialized));
1033  ASSERT_EQ(1, packed.repeated_fixed32_size());
1034  EXPECT_EQ(42, packed.repeated_fixed32(0));
1035 }
1036 
1037 TEST(Lite, MapCrash) {
1038  // See b/113635730
1039  Arena arena;
1040  auto msg = Arena::CreateMessage<protobuf_unittest::TestMapLite>(&arena);
1041  // Payload for the map<string, Enum> with a enum varint that's longer >
1042  // 10 bytes. This causes a parse fail and a subsequent delete. field 16
1043  // (map<int32, MapEnumLite>) tag = 128+2 = \202 \1
1044  // 13 long \15
1045  // int32 key = 1 (\10 \1)
1046  // MapEnumLite value = too long varint (parse error)
1047  EXPECT_FALSE(msg->ParseFromString(
1048  "\202\1\15\10\1\200\200\200\200\200\200\200\200\200\200\1"));
1049 }
1050 
1051 TEST(Lite, CorrectEnding) {
1052  protobuf_unittest::TestAllTypesLite msg;
1053  {
1054  // All proto wireformat parsers should act the same on parsing data in as
1055  // much as it concerns the parsing, ie. not the interpretation of the data.
1056  // TestAllTypesLite is not a group inside another message. So in practice
1057  // will not encounter an end-group tag. However the parser should behave
1058  // like any wire format parser should.
1059  static const char kWireFormat[] = "\204\1";
1060  io::CodedInputStream cis(reinterpret_cast<const uint8*>(kWireFormat), 2);
1061  // The old CodedInputStream parser got an optimization (ReadTagNoLastTag)
1062  // for non-group messages (like TestAllTypesLite) which made it not accept
1063  // end-group. This is not a real big deal, but I think going forward its
1064  // good to have all parse loops behave 'exactly' the same.
1065 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
1066  EXPECT_TRUE(msg.MergePartialFromCodedStream(&cis));
1068  EXPECT_TRUE(cis.LastTagWas(132));
1069 #endif
1070  }
1071  {
1072  // This is an incomplete end-group tag. This should be a genuine parse
1073  // failure.
1074  static const char kWireFormat[] = "\214";
1075  io::CodedInputStream cis(reinterpret_cast<const uint8*>(kWireFormat), 1);
1076  // Unfortunately the old parser detects a parse error in ReadTag and returns
1077  // 0 (as it states 0 is an invalid tag). However 0 is not an invalid tag
1078  // as it can be used to terminate the stream, so this returns true.
1079 #if GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
1080  EXPECT_FALSE(msg.MergePartialFromCodedStream(&cis));
1081 #endif
1082  }
1083 }
1084 
1085 TEST(Lite, DebugString) {
1086  protobuf_unittest::TestAllTypesLite message1, message2;
1087  EXPECT_TRUE(HasPrefixString(message1.DebugString(), "MessageLite at 0x"));
1088  EXPECT_TRUE(HasPrefixString(message2.DebugString(), "MessageLite at 0x"));
1089 
1090  // DebugString() and ShortDebugString() are the same for now.
1091  EXPECT_EQ(message1.DebugString(), message1.ShortDebugString());
1092 
1093  // Even identical lite protos should have different DebugString() output. Part
1094  // of the reason for including the memory address is so that we get some
1095  // non-determinism, which should make it easier for us to change the output
1096  // later without breaking any code.
1097  EXPECT_NE(message1.DebugString(), message2.DebugString());
1098 }
1099 
1100 TEST(Lite, EnumValueToName) {
1101  EXPECT_EQ("FOREIGN_LITE_FOO", protobuf_unittest::ForeignEnumLite_Name(
1102  protobuf_unittest::FOREIGN_LITE_FOO));
1103  EXPECT_EQ("FOREIGN_LITE_BAR", protobuf_unittest::ForeignEnumLite_Name(
1104  protobuf_unittest::FOREIGN_LITE_BAR));
1105  EXPECT_EQ("FOREIGN_LITE_BAZ", protobuf_unittest::ForeignEnumLite_Name(
1106  protobuf_unittest::FOREIGN_LITE_BAZ));
1107  EXPECT_EQ("", protobuf_unittest::ForeignEnumLite_Name(0));
1108  EXPECT_EQ("", protobuf_unittest::ForeignEnumLite_Name(999));
1109 }
1110 
1111 TEST(Lite, NestedEnumValueToName) {
1112  EXPECT_EQ("FOO", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(
1113  protobuf_unittest::TestAllTypesLite::FOO));
1114  EXPECT_EQ("BAR", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(
1115  protobuf_unittest::TestAllTypesLite::BAR));
1116  EXPECT_EQ("BAZ", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(
1117  protobuf_unittest::TestAllTypesLite::BAZ));
1118  EXPECT_EQ("", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(0));
1119  EXPECT_EQ("", protobuf_unittest::TestAllTypesLite::NestedEnum_Name(999));
1120 }
1121 
1122 TEST(Lite, EnumNameToValue) {
1123  protobuf_unittest::ForeignEnumLite value;
1124 
1125  ASSERT_TRUE(
1126  protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_FOO", &value));
1127  EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_FOO, value);
1128 
1129  ASSERT_TRUE(
1130  protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAR", &value));
1131  EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_BAR, value);
1132 
1133  ASSERT_TRUE(
1134  protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_BAZ", &value));
1135  EXPECT_EQ(protobuf_unittest::FOREIGN_LITE_BAZ, value);
1136 
1137  // Non-existent values
1138  EXPECT_FALSE(protobuf_unittest::ForeignEnumLite_Parse("E", &value));
1139  EXPECT_FALSE(
1140  protobuf_unittest::ForeignEnumLite_Parse("FOREIGN_LITE_C", &value));
1141  EXPECT_FALSE(protobuf_unittest::ForeignEnumLite_Parse("G", &value));
1142 }
1143 
1144 TEST(Lite, NestedEnumNameToValue) {
1145  protobuf_unittest::TestAllTypesLite::NestedEnum value;
1146 
1147  ASSERT_TRUE(
1148  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("FOO", &value));
1149  EXPECT_EQ(protobuf_unittest::TestAllTypesLite::FOO, value);
1150 
1151  ASSERT_TRUE(
1152  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("BAR", &value));
1153  EXPECT_EQ(protobuf_unittest::TestAllTypesLite::BAR, value);
1154 
1155  ASSERT_TRUE(
1156  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("BAZ", &value));
1157  EXPECT_EQ(protobuf_unittest::TestAllTypesLite::BAZ, value);
1158 
1159  // Non-existent values
1160  EXPECT_FALSE(
1161  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("A", &value));
1162  EXPECT_FALSE(
1163  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("C", &value));
1164  EXPECT_FALSE(
1165  protobuf_unittest::TestAllTypesLite::NestedEnum_Parse("G", &value));
1166 }
1167 
1168 TEST(Lite, AliasedEnum) {
1169  // Enums with allow_alias = true can have multiple entries with the same
1170  // value.
1171  EXPECT_EQ("FOO1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(
1172  protobuf_unittest::DupEnum::FOO1));
1173  EXPECT_EQ("FOO1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(
1174  protobuf_unittest::DupEnum::FOO2));
1175  EXPECT_EQ("BAR1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(
1176  protobuf_unittest::DupEnum::BAR1));
1177  EXPECT_EQ("BAR1", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(
1178  protobuf_unittest::DupEnum::BAR2));
1179  EXPECT_EQ("BAZ", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(
1180  protobuf_unittest::DupEnum::BAZ));
1181  EXPECT_EQ("", protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Name(999));
1182 
1183  protobuf_unittest::DupEnum::TestEnumWithDupValueLite value;
1184  ASSERT_TRUE(
1185  protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO1", &value));
1186  EXPECT_EQ(protobuf_unittest::DupEnum::FOO1, value);
1187 
1188  value = static_cast<protobuf_unittest::DupEnum::TestEnumWithDupValueLite>(0);
1189  ASSERT_TRUE(
1190  protobuf_unittest::DupEnum::TestEnumWithDupValueLite_Parse("FOO2", &value));
1191  EXPECT_EQ(protobuf_unittest::DupEnum::FOO2, value);
1192 }
1193 
1194 } // namespace protobuf
1195 } // namespace google
ASSIGN_REPEATED_FIELD
#define ASSIGN_REPEATED_FIELD(FIELD)
google::protobuf::TestUtilLite::SetAllFields
static void SetAllFields(unittest::TestAllTypesLite *message)
Definition: test_util_lite.cc:44
google::protobuf::value
const Descriptor::ReservedRange value
Definition: src/google/protobuf/descriptor.h:1954
google::protobuf::TestUtilLite::ExpectExtensionsClear
static void ExpectExtensionsClear(const unittest::TestAllExtensionsLite &message)
Definition: test_util_lite.cc:1348
google::protobuf::MapLiteTestUtil::SetMapFields
static void SetMapFields(protobuf_unittest::TestMapLite *message)
Definition: map_lite_test_util.cc:38
wire_format_lite.h
arena_test_util.h
ASSERT_NE
#define ASSERT_NE(val1, val2)
Definition: gtest.h:2086
google::protobuf.internal::WireFormatLite::WIRETYPE_VARINT
@ WIRETYPE_VARINT
Definition: wire_format_lite.h:102
end
GLuint GLuint end
Definition: glcorearb.h:2858
google::protobuf::TestUtilLite::ExpectPackedFieldsModified
static void ExpectPackedFieldsModified(const unittest::TestPackedTypesLite &message)
Definition: test_util_lite.cc:751
google::protobuf::TestUtilLite::ModifyPackedExtensions
static void ModifyPackedExtensions(unittest::TestPackedExtensionsLite *message)
Definition: test_util_lite.cc:1774
google::protobuf::uint8
uint8_t uint8
Definition: protobuf/src/google/protobuf/stubs/port.h:153
google::protobuf::io::CodedOutputStream::HadError
bool HadError() const
Definition: coded_stream.h:829
gtest.h
google::protobuf::TestUtilLite::SetPackedExtensions
static void SetPackedExtensions(unittest::TestPackedExtensionsLite *message)
Definition: test_util_lite.cc:1737
EXPECT_EQ
#define EXPECT_EQ(val1, val2)
Definition: glog/src/googletest.h:155
google::protobuf::TestUtilLite::ExpectPackedExtensionsClear
static void ExpectPackedExtensionsClear(const unittest::TestPackedExtensionsLite &message)
Definition: test_util_lite.cc:1872
google::protobuf::MapLiteTestUtil::ModifyMapFields
static void ModifyMapFields(protobuf_unittest::TestMapLite *message)
Definition: map_lite_test_util.cc:54
string
GLsizei const GLchar *const * string
Definition: glcorearb.h:3083
google::protobuf::TestUtilLite::ExpectAllExtensionsSet
static void ExpectAllExtensionsSet(const unittest::TestAllExtensionsLite &message)
Definition: test_util_lite.cc:995
google::protobuf::SetAllTypesInEmptyMessageUnknownFields
void SetAllTypesInEmptyMessageUnknownFields(unittest::TestEmptyMessageLite *empty_message)
Definition: lite_unittest.cc:68
google::protobuf::ExpectMessageMerged
void ExpectMessageMerged(const unittest::TestAllTypesLite &message)
Definition: lite_unittest.cc:53
google::protobuf::TestUtilLite::ModifyRepeatedExtensions
static void ModifyRepeatedExtensions(unittest::TestAllExtensionsLite *message)
Definition: test_util_lite.cc:954
ASSERT_EQ
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:2082
google::protobuf::io::CodedOutputStream::ByteCount
int ByteCount() const
Definition: coded_stream.h:1291
test_util_lite.h
strutil.h
google::protobuf::TestUtilLite::ExpectPackedFieldsSet
static void ExpectPackedFieldsSet(const unittest::TestPackedTypesLite &message)
Definition: test_util_lite.cc:680
google::protobuf::io::CodedInputStream::ConsumedEntireMessage
bool ConsumedEntireMessage()
Definition: coded_stream.h:1072
coded_stream.h
EXPECT_NE
#define EXPECT_NE(val1, val2)
Definition: glog/src/googletest.h:156
buffer
GLuint buffer
Definition: glcorearb.h:2939
start
GLuint start
Definition: glcorearb.h:2858
google::protobuf::io::CodedInputStream::LastTagWas
bool LastTagWas(uint32 expected)
Definition: coded_stream.h:1068
google::protobuf::TestUtilLite::ModifyPackedFields
static void ModifyPackedFields(unittest::TestPackedTypesLite *message)
Definition: test_util_lite.cc:661
google::protobuf::io::ArrayOutputStream
Definition: zero_copy_stream_impl_lite.h:99
google::protobuf::TestUtilLite::ExpectClear
static void ExpectClear(const unittest::TestAllTypesLite &message)
Definition: test_util_lite.cc:393
google::protobuf::TEST
TEST(ArenaTest, ArenaConstructable)
Definition: arena_unittest.cc:156
EXPECT_TRUE
#define EXPECT_TRUE(cond)
Definition: glog/src/googletest.h:137
google::protobuf::string_as_array
char * string_as_array(string *str)
Definition: stl_util.h:83
map_lite_test_util.h
buffer
Definition: buffer_processor.h:43
ASSERT_TRUE
#define ASSERT_TRUE(condition)
Definition: gtest.h:1995
google::protobuf::TestUtilLite::SetAllExtensions
static void SetAllExtensions(unittest::TestAllExtensionsLite *message)
Definition: test_util_lite.cc:808
google::protobuf::HasPrefixString
bool HasPrefixString(const string &str, const string &prefix)
Definition: strutil.h:115
ASSIGN_REPEATED_GROUP
#define ASSIGN_REPEATED_GROUP(FIELD)
google::protobuf::AssignParsingMergeMessages
void AssignParsingMergeMessages(unittest::TestAllTypesLite *msg1, unittest::TestAllTypesLite *msg2, unittest::TestAllTypesLite *msg3)
Definition: lite_unittest.cc:59
google::protobuf::io::CodedOutputStream
Definition: coded_stream.h:693
i
int i
Definition: gmock-matchers_test.cc:764
google::protobuf::SetSomeTypesInEmptyMessageUnknownFields
void SetSomeTypesInEmptyMessageUnknownFields(unittest::TestEmptyMessageLite *empty_message)
Definition: lite_unittest.cc:77
zero_copy_stream_impl_lite.h
google::protobuf::MapLiteTestUtil::ExpectMapFieldsSetInitialized
static void ExpectMapFieldsSetInitialized(const protobuf_unittest::TestMapLite &message)
Definition: map_lite_test_util.cc:77
google::protobuf::io::StringOutputStream
Definition: zero_copy_stream_impl_lite.h:131
google::protobuf::TestUtilLite::ExpectPackedExtensionsSet
static void ExpectPackedExtensionsSet(const unittest::TestPackedExtensionsLite &message)
Definition: test_util_lite.cc:1795
common.h
google::protobuf::TestUtilLite::ExpectPackedClear
static void ExpectPackedClear(const unittest::TestPackedTypesLite &message)
Definition: test_util_lite.cc:730
google::protobuf.internal::WireFormatLite::WriteTag
static PROTOBUF_ALWAYS_INLINE void WriteTag(int field_number, WireType type, io::CodedOutputStream *output)
Definition: wire_format_lite.h:1272
google::protobuf::TestUtilLite::ExpectPackedExtensionsModified
static void ExpectPackedExtensionsModified(const unittest::TestPackedExtensionsLite &message)
Definition: test_util_lite.cc:1892
size
GLsizeiptr size
Definition: glcorearb.h:2943
google::protobuf::TestUtilLite::ModifyRepeatedFields
static void ModifyRepeatedFields(unittest::TestAllTypesLite *message)
Definition: test_util_lite.cc:161
EXPECT_FALSE
#define EXPECT_FALSE(cond)
Definition: glog/src/googletest.h:145
google::protobuf::io::CodedInputStream
Definition: coded_stream.h:173
logging.h
google::protobuf::MapLiteTestUtil::ExpectMapFieldsSet
static void ExpectMapFieldsSet(const protobuf_unittest::TestMapLite &message)
Definition: map_lite_test_util.cc:63
google::protobuf::TestUtilLite::ExpectRepeatedFieldsModified
static void ExpectRepeatedFieldsModified(const unittest::TestAllTypesLite &message)
Definition: test_util_lite.cc:538
google::protobuf::TestUtilLite::ExpectAllFieldsSet
static void ExpectAllFieldsSet(const unittest::TestAllTypesLite &message)
Definition: test_util_lite.cc:192
google::protobuf::MapLiteTestUtil::ExpectMapFieldsModified
static void ExpectMapFieldsModified(const protobuf_unittest::TestMapLite &message)
Definition: map_lite_test_util.cc:84
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: glcorearb.h:2879
google::protobuf::TestUtilLite::ExpectRepeatedExtensionsModified
static void ExpectRepeatedExtensionsModified(const unittest::TestAllExtensionsLite &message)
Definition: test_util_lite.cc:1569
google::protobuf::TestUtilLite::SetPackedFields
static void SetPackedFields(unittest::TestPackedTypesLite *message)
Definition: test_util_lite.cc:627
value
GLsizei const GLfloat * value
Definition: glcorearb.h:3093
a
GLboolean GLboolean GLboolean GLboolean a
Definition: glcorearb.h:3228
google::protobuf::io::CodedOutputStream::WriteVarint32
void WriteVarint32(uint32 value)
Definition: coded_stream.h:1213
google
Definition: data_proto2_to_proto3_util.h:11
message
GLenum GLuint GLenum GLsizei const GLchar * message
Definition: glcorearb.h:2695
google::protobuf::MapLiteTestUtil::ExpectClear
static void ExpectClear(const protobuf_unittest::TestMapLite &message)
Definition: map_lite_test_util.cc:59
google::protobuf::MapLiteTestUtil::SetMapFieldsInitialized
static void SetMapFieldsInitialized(protobuf_unittest::TestMapLite *message)
Definition: map_lite_test_util.cc:50


libaditof
Author(s):
autogenerated on Wed May 21 2025 02:06:55