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

Side by Side Diff: tests/corelib/src/ListImplementationVMTest.dart

Issue 8339015: Rename GrowableObjectArray to ListImplementation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « tests/corelib/src/ListImplementation2VMTest.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library("GrowableObjectArrayTest.dart"); 5 #library("ListImplementationTest.dart");
6 #import("dart:coreimpl"); 6 #import("dart:coreimpl");
7 7
8 class GrowableObjectArrayTest { 8 class ListImplementationTest {
9 9
10 static void testOutOfBoundForIndexOf() { 10 static void testOutOfBoundForIndexOf() {
11 GrowableObjectArray<int> array = new GrowableObjectArray<int>(); 11 ListImplementation<int> array = new ListImplementation<int>();
12 for (int i = 0; i < 64; i++) { 12 for (int i = 0; i < 64; i++) {
13 array.add(i); 13 array.add(i);
14 Expect.equals(-1, array.indexOf(4, i + 1)); 14 Expect.equals(-1, array.indexOf(4, i + 1));
15 Expect.equals(-1, array.lastIndexOf(4, -1)); 15 Expect.equals(-1, array.lastIndexOf(4, -1));
16 } 16 }
17 } 17 }
18 18
19 static testMain() { 19 static testMain() {
20 GrowableObjectArray<int> array = new GrowableObjectArray<int>(); 20 ListImplementation<int> array = new ListImplementation<int>();
21 array.add(1); 21 array.add(1);
22 array.add(2); 22 array.add(2);
23 array.add(3); 23 array.add(3);
24 array.add(4); 24 array.add(4);
25 array.add(1); 25 array.add(1);
26 26
27 Expect.equals(3, array.indexOf(4, 0)); 27 Expect.equals(3, array.indexOf(4, 0));
28 Expect.equals(0, array.indexOf(1, 0)); 28 Expect.equals(0, array.indexOf(1, 0));
29 Expect.equals(4, array.lastIndexOf(1, array.length - 1)); 29 Expect.equals(4, array.lastIndexOf(1, array.length - 1));
30 30
(...skipping 27 matching lines...) Expand all
58 array.add(1); 58 array.add(1);
59 array.add(1); 59 array.add(1);
60 array.add(2); 60 array.add(2);
61 61
62 Expect.equals(5, array.length); 62 Expect.equals(5, array.length);
63 array = array.filter((e) => e != 1 ); 63 array = array.filter((e) => e != 1 );
64 Expect.equals(1, array.length); 64 Expect.equals(1, array.length);
65 Expect.equals(2, array[0]); 65 Expect.equals(2, array[0]);
66 66
67 // Check correct copy order/ 67 // Check correct copy order/
68 array = new GrowableObjectArray<int>(); 68 array = new ListImplementation<int>();
69 for (int i = 0; i < 10; i++) { 69 for (int i = 0; i < 10; i++) {
70 array.add(i); 70 array.add(i);
71 } 71 }
72 array.copyFrom(array, 7, 8, 2); 72 array.copyFrom(array, 7, 8, 2);
73 Expect.equals(7, array[7]); 73 Expect.equals(7, array[7]);
74 Expect.equals(7, array[8]); 74 Expect.equals(7, array[8]);
75 Expect.equals(8, array[9]); 75 Expect.equals(8, array[9]);
76 array.copyFrom(array, 5, 4, 2); 76 array.copyFrom(array, 5, 4, 2);
77 Expect.equals(5, array[4]); 77 Expect.equals(5, array[4]);
78 Expect.equals(6, array[5]); 78 Expect.equals(6, array[5]);
79 Expect.equals(6, array[6]); 79 Expect.equals(6, array[6]);
80 80
81 testOutOfBoundForIndexOf(); 81 testOutOfBoundForIndexOf();
82 82
83 GrowableObjectArray<int> h = new GrowableObjectArray<int>.withCapacity(10); 83 ListImplementation<int> h = new ListImplementation<int>.withCapacity(10);
84 Array constArray = const [0, 1, 2, 3, 4]; 84 Array constArray = const [0, 1, 2, 3, 4];
85 h.addAll(constArray); 85 h.addAll(constArray);
86 Expect.equals(5, h.length); 86 Expect.equals(5, h.length);
87 } 87 }
88 } 88 }
89 89
90 main() { 90 main() {
91 GrowableObjectArrayTest.testMain(); 91 ListImplementationTest.testMain();
92 } 92 }
OLDNEW
« no previous file with comments | « tests/corelib/src/ListImplementation2VMTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698