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

Side by Side Diff: test/cctest/test-list.cc

Issue 18509003: Keep two empty lines between declarations for cpp files (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 return result + 1; 44 return result + 1;
45 } 45 }
46 46
47 static void Delete(void* ptr) { 47 static void Delete(void* ptr) {
48 size_t* true_ptr = reinterpret_cast<size_t*>(ptr) - 1; 48 size_t* true_ptr = reinterpret_cast<size_t*>(ptr) - 1;
49 memset(true_ptr, 0, *true_ptr); 49 memset(true_ptr, 0, *true_ptr);
50 free(true_ptr); 50 free(true_ptr);
51 } 51 }
52 }; 52 };
53 53
54
54 // Check that we can add (a reference to) an element of the list 55 // Check that we can add (a reference to) an element of the list
55 // itself. 56 // itself.
56 TEST(ListAdd) { 57 TEST(ListAdd) {
57 // Add elements to the list to grow it to its capacity. 58 // Add elements to the list to grow it to its capacity.
58 List<int, ZeroingAllocationPolicy> list(4); 59 List<int, ZeroingAllocationPolicy> list(4);
59 list.Add(1); 60 list.Add(1);
60 list.Add(2); 61 list.Add(2);
61 list.Add(3); 62 list.Add(3);
62 list.Add(4); 63 list.Add(4);
63 64
64 // Add an existing element, the backing store should have to grow. 65 // Add an existing element, the backing store should have to grow.
65 list.Add(list[0]); 66 list.Add(list[0]);
66 CHECK_EQ(1, list[4]); 67 CHECK_EQ(1, list[4]);
67 } 68 }
68 69
70
69 // Test that we can add all elements from a list to another list. 71 // Test that we can add all elements from a list to another list.
70 TEST(ListAddAll) { 72 TEST(ListAddAll) {
71 List<int, ZeroingAllocationPolicy> list(4); 73 List<int, ZeroingAllocationPolicy> list(4);
72 list.Add(0); 74 list.Add(0);
73 list.Add(1); 75 list.Add(1);
74 list.Add(2); 76 list.Add(2);
75 77
76 CHECK_EQ(3, list.length()); 78 CHECK_EQ(3, list.length());
77 for (int i = 0; i < 3; i++) { 79 for (int i = 0; i < 3; i++) {
78 CHECK_EQ(i, list[i]); 80 CHECK_EQ(i, list[i]);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 156
155 TEST(DeleteEmpty) { 157 TEST(DeleteEmpty) {
156 { 158 {
157 List<int>* list = new List<int>(0); 159 List<int>* list = new List<int>(0);
158 delete list; 160 delete list;
159 } 161 }
160 { 162 {
161 List<int> list(0); 163 List<int> list(0);
162 } 164 }
163 } 165 }
OLDNEW
« no previous file with comments | « test/cctest/test-heap-profiler.cc ('k') | test/cctest/test-lockers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698