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

Side by Side Diff: third_party/WebKit/Source/wtf/VectorTest.cpp

Issue 2386843002: reflow comments in wtf (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/wtf/Vector.h ('k') | third_party/WebKit/Source/wtf/VectorTraits.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 limit = vector.capacity() + 1; 434 limit = vector.capacity() + 1;
435 for (size_t i = 0; i < limit; i++) 435 for (size_t i = 0; i < limit; i++)
436 vector.append(const_cast<const WTF::String&>(vector.first())); 436 vector.append(const_cast<const WTF::String&>(vector.first()));
437 } 437 }
438 438
439 // The test below is for the following issue: 439 // The test below is for the following issue:
440 // 440 //
441 // https://bugs.chromium.org/p/chromium/issues/detail?id=592767 441 // https://bugs.chromium.org/p/chromium/issues/detail?id=592767
442 // 442 //
443 // where deleted copy assignment operator made canMoveWithMemcpy true because of the implementation of 443 // where deleted copy assignment operator made canMoveWithMemcpy true because
444 // IsTriviallyMoveAssignable<T>. 444 // of the implementation of IsTriviallyMoveAssignable<T>.
445 445
446 class MojoMoveOnlyType final { 446 class MojoMoveOnlyType final {
447 public: 447 public:
448 MojoMoveOnlyType(); 448 MojoMoveOnlyType();
449 MojoMoveOnlyType(MojoMoveOnlyType&&); 449 MojoMoveOnlyType(MojoMoveOnlyType&&);
450 MojoMoveOnlyType& operator=(MojoMoveOnlyType&&); 450 MojoMoveOnlyType& operator=(MojoMoveOnlyType&&);
451 ~MojoMoveOnlyType(); 451 ~MojoMoveOnlyType();
452 452
453 private: 453 private:
454 MojoMoveOnlyType(const MojoMoveOnlyType&) = delete; 454 MojoMoveOnlyType(const MojoMoveOnlyType&) = delete;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 one = {1}; 624 one = {1};
625 ASSERT_EQ(1u, one.size()); 625 ASSERT_EQ(1u, one.size());
626 EXPECT_EQ(1, one[0]); 626 EXPECT_EQ(1, one[0]);
627 627
628 oneTwoThree = {1, 2, 3}; 628 oneTwoThree = {1, 2, 3};
629 ASSERT_EQ(3u, oneTwoThree.size()); 629 ASSERT_EQ(3u, oneTwoThree.size());
630 EXPECT_EQ(1, oneTwoThree[0]); 630 EXPECT_EQ(1, oneTwoThree[0]);
631 EXPECT_EQ(2, oneTwoThree[1]); 631 EXPECT_EQ(2, oneTwoThree[1]);
632 EXPECT_EQ(3, oneTwoThree[2]); 632 EXPECT_EQ(3, oneTwoThree[2]);
633 633
634 // Other ways of construction: as a function parameter and in a return stateme nt. 634 // Other ways of construction: as a function parameter and in a return
635 // statement.
635 EXPECT_TRUE(isOneTwoThree({1, 2, 3})); 636 EXPECT_TRUE(isOneTwoThree({1, 2, 3}));
636 EXPECT_TRUE(isOneTwoThree(returnOneTwoThree())); 637 EXPECT_TRUE(isOneTwoThree(returnOneTwoThree()));
637 638
638 // The tests below correspond to the cases in the "if" branch in operator=(std ::initializer_list<T>). 639 // The tests below correspond to the cases in the "if" branch in
640 // operator=(std::initializer_list<T>).
639 641
640 // Shrinking. 642 // Shrinking.
641 Vector<int, 1> vector1(3); // capacity = 3. 643 Vector<int, 1> vector1(3); // capacity = 3.
642 vector1 = {1, 2}; 644 vector1 = {1, 2};
643 ASSERT_EQ(2u, vector1.size()); 645 ASSERT_EQ(2u, vector1.size());
644 EXPECT_EQ(1, vector1[0]); 646 EXPECT_EQ(1, vector1[0]);
645 EXPECT_EQ(2, vector1[1]); 647 EXPECT_EQ(2, vector1[1]);
646 648
647 // Expanding. 649 // Expanding.
648 Vector<int, 1> vector2(3); 650 Vector<int, 1> vector2(3);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 static_assert(VectorTraits<UChar>::canCopyWithMemcpy, 699 static_assert(VectorTraits<UChar>::canCopyWithMemcpy,
698 "UChar should be copied with memcpy."); 700 "UChar should be copied with memcpy.");
699 701
700 class UnknownType; 702 class UnknownType;
701 static_assert(VectorTraits<UnknownType*>::canCopyWithMemcpy, 703 static_assert(VectorTraits<UnknownType*>::canCopyWithMemcpy,
702 "Pointers should be copied with memcpy."); 704 "Pointers should be copied with memcpy.");
703 705
704 } // anonymous namespace 706 } // anonymous namespace
705 707
706 } // namespace WTF 708 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/Vector.h ('k') | third_party/WebKit/Source/wtf/VectorTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698