OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 message.set_foo_int(1); | 412 message.set_foo_int(1); |
413 EXPECT_TRUE(ReflectionOps::IsInitialized(message)); | 413 EXPECT_TRUE(ReflectionOps::IsInitialized(message)); |
414 | 414 |
415 message.mutable_foo_message(); | 415 message.mutable_foo_message(); |
416 EXPECT_FALSE(ReflectionOps::IsInitialized(message)); | 416 EXPECT_FALSE(ReflectionOps::IsInitialized(message)); |
417 message.mutable_foo_message()->set_required_double(0.1); | 417 message.mutable_foo_message()->set_required_double(0.1); |
418 EXPECT_TRUE(ReflectionOps::IsInitialized(message)); | 418 EXPECT_TRUE(ReflectionOps::IsInitialized(message)); |
419 } | 419 } |
420 | 420 |
421 static string FindInitializationErrors(const Message& message) { | 421 static string FindInitializationErrors(const Message& message) { |
422 vector<string> errors; | 422 std::vector<string> errors; |
423 ReflectionOps::FindInitializationErrors(message, "", &errors); | 423 ReflectionOps::FindInitializationErrors(message, "", &errors); |
424 return Join(errors, ","); | 424 return Join(errors, ","); |
425 } | 425 } |
426 | 426 |
427 TEST(ReflectionOpsTest, FindInitializationErrors) { | 427 TEST(ReflectionOpsTest, FindInitializationErrors) { |
428 unittest::TestRequired message; | 428 unittest::TestRequired message; |
429 EXPECT_EQ("a,b,c", FindInitializationErrors(message)); | 429 EXPECT_EQ("a,b,c", FindInitializationErrors(message)); |
430 } | 430 } |
431 | 431 |
432 TEST(ReflectionOpsTest, FindForeignInitializationErrors) { | 432 TEST(ReflectionOpsTest, FindForeignInitializationErrors) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 unittest::TestRequiredOneof message; | 467 unittest::TestRequiredOneof message; |
468 message.mutable_foo_message(); | 468 message.mutable_foo_message(); |
469 EXPECT_EQ("foo_message.required_double", | 469 EXPECT_EQ("foo_message.required_double", |
470 FindInitializationErrors(message)); | 470 FindInitializationErrors(message)); |
471 } | 471 } |
472 | 472 |
473 } // namespace | 473 } // namespace |
474 } // namespace internal | 474 } // namespace internal |
475 } // namespace protobuf | 475 } // namespace protobuf |
476 } // namespace google | 476 } // namespace google |
OLD | NEW |