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

Side by Side Diff: frog/tests/leg_only/for_test.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 | « frog/tests/leg_only/for_in_test.dart ('k') | frog/tests/leg_only/function_parameters_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 void for1() {
6 var cond = true;
7 var result = 0;
8 for (var x = 0; cond; x = x + 1) {
9 if (x == 10) cond = false;
10 result = result + x;
11 }
12 Expect.equals(55, result);
13 }
14
15 void for2() {
16 var t = 0;
17 for (var i = 0; i == 0; i = i + 1) {
18 t = t + 10;
19 }
20 Expect.equals(10, t);
21 }
22
23 void for3() {
24 for (var i = 0; i == 1; i = i + 1) {
25 Expect.fail('unreachable');
26 }
27 }
28
29 void for4() {
30 var cond1 = true;
31 var result = 0;
32 for (var i = 0; cond1; i = i + 1) {
33 if (i == 9) cond1 = false;
34 var cond2 = true;
35 for (var j = 0; cond2; j = j + 1) {
36 if (j == 9) cond2 = false;
37 result = result + 1;
38 }
39 }
40 Expect.equals(100, result);
41 }
42
43 void for5() {
44 var i;
45 var sum = 0;
46 for (i = 0; i < 5; i++) {
47 sum += i;
48 }
49 Expect.equals(5, i);
50 Expect.equals(10, sum);
51 }
52
53 void for6() {
54 var i = 0;
55 var sum = 0;
56 for(; i < 5; i++) {
57 sum += i;
58 }
59 Expect.equals(5, i);
60 Expect.equals(10, sum);
61
62 sum = 0;
63 i = 0;
64 for(; i < 5;) {
65 sum += i;
66 i++;
67 }
68 Expect.equals(5, i);
69 Expect.equals(10, sum);
70
71 sum = 0;
72 for(i = 0; i < 5;) {
73 sum += i;
74 i++;
75 }
76 Expect.equals(5, i);
77 Expect.equals(10, sum);
78 }
79
80 void main() {
81 for1();
82 for2();
83 for3();
84 for4();
85 for5();
86 for6();
87 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/for_in_test.dart ('k') | frog/tests/leg_only/function_parameters_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698