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

Side by Side Diff: dart/frog/tests/leg/src/LinkTest.dart

Issue 8566003: Revert various changes to Link factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: frogsh Created 9 years, 1 month 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 | « dart/frog/leg/util/link_implementation.dart ('k') | dart/frog/type.dart » ('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 (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 #import('../../../leg/util/util.dart'); 5 #import('../../../leg/util/util.dart');
6 #import('../../../leg/util/util_implementation.dart'); 6 #import('../../../leg/util/util_implementation.dart');
7 7
8 main() { 8 main() {
9 test(LinkFactory.createLink('three').prepend(2).prepend('one'), 9 test(new Link<Comparable>('three').prepend(2).prepend('one'),
10 ['one', 2, 'three']); 10 ['one', 2, 'three']);
11 test(LinkFactory.createLink(3).prepend('two').prepend(1), [1, 'two', 3]); 11 test(new Link<Comparable>(3).prepend('two').prepend(1), [1, 'two', 3]);
12 test(LinkFactory.createLink('single'), ['single']); 12 test(new Link<String>('single'), ['single']);
13 test(new LinkTail(), []); 13 test(new LinkTail(), []);
14 testFromList([]); 14 // TODO(ahe): Fails in checked mode.
Ivan Posva 2011/11/14 16:32:21 Please verify whether this statement is still corr
ahe 2011/11/15 16:12:40 It isn't, and I have remove the comment in a new C
15 // testFromList([]);
15 testFromList([0]); 16 testFromList([0]);
16 testFromList([0, 1]); 17 testFromList([0, 1]);
17 testFromList([0, 1, 2]); 18 testFromList([0, 1, 2]);
18 testFromList([0, 1, 2, 3]); 19 testFromList([0, 1, 2, 3]);
19 testFromList([0, 1, 2, 3, 4]); 20 testFromList([0, 1, 2, 3, 4]);
20 testFromList([0, 1, 2, 3, 4, 5]); 21 testFromList([0, 1, 2, 3, 4, 5]);
21 } 22 }
22 23
23 testFromList(List list) { 24 testFromList(List list) {
24 test(LinkFactory.createFromList(list), list); 25 test(new Link.fromList(list), list);
25 } 26 }
26 27
27 test(Link link, List list) { 28 test(Link link, List list) {
28 Expect.equals(list.isEmpty(), link.isEmpty()); 29 Expect.equals(list.isEmpty(), link.isEmpty());
29 int i = 0; 30 int i = 0;
30 for (var element in link.toList()) { 31 for (var element in link.toList()) {
31 Expect.equals(list[i++], element); 32 Expect.equals(list[i++], element);
32 } 33 }
33 Expect.equals(list.length, i); 34 Expect.equals(list.length, i);
34 i = 0; 35 i = 0;
35 for (var element in link) { 36 for (var element in link) {
36 Expect.equals(list[i++], element); 37 Expect.equals(list[i++], element);
37 } 38 }
38 Expect.equals(list.length, i); 39 Expect.equals(list.length, i);
39 i = 0; 40 i = 0;
40 for (; !link.isEmpty(); link = link.tail) { 41 for (; !link.isEmpty(); link = link.tail) {
41 Expect.equals(list[i++], link.head); 42 Expect.equals(list[i++], link.head);
42 } 43 }
43 Expect.equals(list.length, i); 44 Expect.equals(list.length, i);
44 Expect.isTrue(link.isEmpty()); 45 Expect.isTrue(link.isEmpty());
45 } 46 }
OLDNEW
« no previous file with comments | « dart/frog/leg/util/link_implementation.dart ('k') | dart/frog/type.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698