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

Unified Diff: test/cctest/test-list.cc

Issue 115705: Remove list copy constructor (for which there was no corresponding... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/virtual-frame.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-list.cc
===================================================================
--- test/cctest/test-list.cc (revision 2025)
+++ test/cctest/test-list.cc (working copy)
@@ -65,3 +65,37 @@
list.Add(list[0]);
CHECK_EQ(1, list[4]);
}
+
+// Test that we can add all elements from a list to another list.
+TEST(ListAddAll) {
+ List<int, ZeroingAllocationPolicy> list(4);
+ list.Add(0);
+ list.Add(1);
+ list.Add(2);
+
+ CHECK_EQ(3, list.length());
+ for (int i = 0; i < 3; i++) {
+ CHECK_EQ(i, list[i]);
+ }
+
+ List<int, ZeroingAllocationPolicy> other_list(4);
+
+ // Add no elements to list since other_list is empty.
+ list.AddAll(other_list);
+ CHECK_EQ(3, list.length());
+ for (int i = 0; i < 3; i++) {
+ CHECK_EQ(i, list[i]);
+ }
+
+ // Add three elements to other_list.
+ other_list.Add(0);
+ other_list.Add(1);
+ other_list.Add(2);
+
+ // Copy the three elements from other_list to list.
+ list.AddAll(other_list);
+ CHECK_EQ(6, list.length());
+ for (int i = 0; i < 6; i++) {
+ CHECK_EQ(i % 3, list[i]);
+ }
+}
« no previous file with comments | « src/virtual-frame.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698