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

Unified Diff: runtime/vm/growable_array_test.cc

Issue 850473002: MallocGrowableArray (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | « runtime/vm/growable_array.h ('k') | runtime/vm/zone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/growable_array_test.cc
===================================================================
--- runtime/vm/growable_array_test.cc (revision 42760)
+++ runtime/vm/growable_array_test.cc (working copy)
@@ -8,8 +8,9 @@
namespace dart {
-TEST_CASE(GrowableArray) {
- GrowableArray<int> g;
+template<class GrowableArrayInt, class GrowableArrayInt64>
+void TestGrowableArray() {
+ GrowableArrayInt g;
EXPECT_EQ(0, g.length());
EXPECT(g.is_empty());
g.Add(5);
@@ -17,7 +18,7 @@
EXPECT_EQ(1, g.length());
EXPECT(!g.is_empty());
g.Add(3);
- const GrowableArray<int>& temp = g;
+ const GrowableArrayInt& temp = g;
EXPECT_EQ(5, temp[0]);
EXPECT_EQ(3, temp[1]);
for (int i = 0; i < 10000; i++) {
@@ -26,7 +27,7 @@
EXPECT_EQ(10002, g.length());
EXPECT_EQ(10000 - 1, g.Last());
- GrowableArray<int64_t> f(10);
+ GrowableArrayInt64 f(10);
EXPECT_EQ(0, f.length());
f.Add(-1LL);
f.Add(15LL);
@@ -38,7 +39,7 @@
EXPECT_EQ(100 - 1, f.Last());
EXPECT_EQ(-1LL, f[0]);
- GrowableArray<int> h;
+ GrowableArrayInt h;
EXPECT_EQ(0, h.length());
h.Add(101);
h.Add(102);
@@ -62,6 +63,18 @@
}
+TEST_CASE(GrowableArray) {
+ TestGrowableArray<GrowableArray<int>,
+ GrowableArray<int64_t> >();
+}
+
+
+TEST_CASE(MallocGrowableArray) {
+ TestGrowableArray<MallocGrowableArray<int>,
+ MallocGrowableArray<int64_t> >();
+}
+
+
static int greatestFirst(const int* a, const int* b) {
if (*a > *b) {
return -1;
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698