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

Side by Side Diff: tests/language/src/CompileTimeConstantITest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2012, 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 class A {
6 final x = 4;
7 const A(this.x);
8 const A.redirect(x) : this(x + 1);
9 const A.optional([this.x = 5]);
10 }
11
12 class B extends A {
13 const B(x, this.y) : super(x);
14 const B.redirect(x, y) : this(x + 22, y + 22);
15 const B.redirect2(x, y) : this.redirect3(x + 122, y + 122);
16 const B.redirect3(x, y) : this.y = y, super.redirect(x);
17 const B.optional(x, [this.y]) : super(x);
18 const B.optional2([x, this.y]) : super(x);
19 final y;
20 }
21
22 class C extends B {
23 const C(x, y, this.z) : super(x, y);
24 const C.redirect(x, y, z) : this(x + 33, y + 33, z + 33);
25 const C.redirect2(x, y, z) : this.redirect3(x + 333, y + 333, z + 333);
26 const C.redirect3(x, y, z) : this.z = z, super.redirect2(x, y);
27 const C.optional(x, [y, this.z]) : super(x, y);
28 const C.optional2([x, y, z]): this.z = z, super(x, y);
29 const C.optional3([this.z]) : super.optional2();
30 final z;
31 }
32
33 final a1 = const A(499);
34 final a2 = const A.redirect(10499);
35 final a3 = const A.optional();
36 final a1b = const A.redirect(498);
37 final a3b = const A(5);
38
39 final b1 = const B(99499, -99499);
40 final b2 = const B.redirect(1234, 5678);
41 final b3 = const B.redirect2(112233, 556677);
42 final b4 = const B.redirect3(332211, 776655);
43 final b5 = const B.optional(43526);
44 final b6 = const B.optional2(y: 9753, x:8642);
45 final b3b = const B(112233 + 122 + 1, 556677 + 122);
46 final b6b = const B(8642, 9753);
47
48 final c1 = const C(121, 232, 343);
49 final c2 = const C.redirect(12321, 23432, 34543);
50 final c3 = const C.redirect2(32123, 43234, 54345);
51 final c4 = const C.redirect3(313, 424, 535);
52 final c5 = const C.optional(191, 181, 171);
53 final c6 = const C.optional(-191);
54 final c7 = const C.optional2();
55 final c8 = const C.optional3(9911);
56 final c3b = const C(32123 + 333 + 122 + 1, 43234 + 333 + 122, 54345 + 333);
57
58 main() {
59 Expect.equals(499, a1.x);
60 Expect.equals(10500, a2.x);
61 Expect.equals(5, a3.x);
62 Expect.identical(a1, a1b);
63 Expect.identical(a3, a3b);
64
65 Expect.equals(99499, b1.x);
66 Expect.equals(-99499, b1.y);
67 Expect.equals(1256, b2.x);
68 Expect.equals(5700, b2.y);
69 Expect.equals(112233 + 122 + 1, b3.x);
70 Expect.equals(556677 + 122, b3.y);
71 Expect.equals(332211 + 1, b4.x);
72 Expect.equals(776655, b4.y);
73 Expect.equals(43526, b5.x);
74 Expect.equals(null, b5.y);
75 Expect.equals(8642, b6.x);
76 Expect.equals(9753, b6.y);
77 Expect.identical(b3, b3b);
78 Expect.identical(b6, b6b);
79
80 Expect.equals(121, c1.x);
81 Expect.equals(232, c1.y);
82 Expect.equals(343, c1.z);
83 Expect.equals(12321 + 33, c2.x);
84 Expect.equals(23432 + 33, c2.y);
85 Expect.equals(34543 + 33, c2.z);
86 Expect.equals(32123 + 333 + 122 + 1, c3.x);
87 Expect.equals(43234 + 333 + 122, c3.y);
88 Expect.equals(54345 + 333, c3.z);
89 Expect.equals(313 + 122 + 1, c4.x);
90 Expect.equals(424 + 122, c4.y);
91 Expect.equals(535, c4.z);
92 Expect.equals(191, c5.x);
93 Expect.equals(181, c5.y);
94 Expect.equals(171, c5.z);
95 Expect.equals(-191, c6.x);
96 Expect.equals(null, c6.y);
97 Expect.equals(null, c6.z);
98 Expect.equals(null, c7.x);
99 Expect.equals(null, c7.y);
100 Expect.equals(null, c7.z);
101 Expect.equals(null, c8.x);
102 Expect.equals(null, c8.y);
103 Expect.equals(9911, c8.z);
104 Expect.identical(c3, c3b);
105 }
OLDNEW
« no previous file with comments | « tests/language/src/CompileTimeConstantHTest.dart ('k') | tests/language/src/CompileTimeConstantJTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698