Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: third_party/protobuf/src/google/protobuf/repeated_field_unittest.cc

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 1515
1516 new_data = goldenproto.add_repeated_string(); 1516 new_data = goldenproto.add_repeated_string();
1517 *new_data = "name-" + SimpleItoa(i); 1517 *new_data = "name-" + SimpleItoa(i);
1518 } 1518 }
1519 TestAllTypes testproto; 1519 TestAllTypes testproto;
1520 std::copy(data.begin(), data.end(), AllocatedRepeatedPtrFieldBackInserter( 1520 std::copy(data.begin(), data.end(), AllocatedRepeatedPtrFieldBackInserter(
1521 testproto.mutable_repeated_string())); 1521 testproto.mutable_repeated_string()));
1522 EXPECT_EQ(testproto.DebugString(), goldenproto.DebugString()); 1522 EXPECT_EQ(testproto.DebugString(), goldenproto.DebugString());
1523 } 1523 }
1524 1524
1525 TEST_F(RepeatedFieldInsertionIteratorsTest,
1526 UnsafeArenaAllocatedRepeatedPtrFieldWithStringIntData) {
1527 vector<Nested*> data;
1528 TestAllTypes goldenproto;
1529 for (int i = 0; i < 10; ++i) {
1530 Nested* new_data = new Nested;
1531 new_data->set_bb(i);
1532 data.push_back(new_data);
1533
1534 new_data = goldenproto.add_repeated_nested_message();
1535 new_data->set_bb(i);
1536 }
1537 TestAllTypes testproto;
1538 std::copy(data.begin(), data.end(),
1539 UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
1540 testproto.mutable_repeated_nested_message()));
1541 EXPECT_EQ(testproto.DebugString(), goldenproto.DebugString());
1542 }
1543
1544 TEST_F(RepeatedFieldInsertionIteratorsTest,
1545 UnsafeArenaAllocatedRepeatedPtrFieldWithString) {
1546 vector<string*> data;
1547 TestAllTypes goldenproto;
1548 for (int i = 0; i < 10; ++i) {
1549 string* new_data = new string;
1550 *new_data = "name-" + SimpleItoa(i);
1551 data.push_back(new_data);
1552
1553 new_data = goldenproto.add_repeated_string();
1554 *new_data = "name-" + SimpleItoa(i);
1555 }
1556 TestAllTypes testproto;
1557 std::copy(data.begin(), data.end(),
1558 UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
1559 testproto.mutable_repeated_string()));
1560 EXPECT_EQ(testproto.DebugString(), goldenproto.DebugString());
1561 }
1562
1525 } // namespace 1563 } // namespace
1526 1564
1527 } // namespace protobuf 1565 } // namespace protobuf
1528 } // namespace google 1566 } // namespace google
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698