OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 // Dart test program for testing optional named parameters. | 4 // Dart test program for testing optional named parameters. |
5 | 5 |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 | 7 |
8 | 8 |
9 class OptionalNamedParametersTest { | 9 class OptionalNamedParametersTest { |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 static void test() { | 59 static void test() { |
60 OptionalNamedParametersTest np = new OptionalNamedParametersTest(); | 60 OptionalNamedParametersTest np = new OptionalNamedParametersTest(); |
61 Expect.equals(0, F00()); | 61 Expect.equals(0, F00()); |
62 Expect.equals(0, np.f11()); | 62 Expect.equals(0, np.f11()); |
63 Expect.equals(10, F11(10)); | 63 Expect.equals(10, F11(10)); |
64 Expect.equals(10, np.f22(10)); | 64 Expect.equals(10, np.f22(10)); |
65 Expect.equals(20, F10()); | 65 Expect.equals(20, F10()); |
66 Expect.equals(20, np.f21()); | 66 Expect.equals(20, np.f21()); |
67 Expect.equals(20, F10(20)); /// 01: runtime error | 67 Expect.equals(20, F10(20)); //# 01: runtime error |
68 Expect.equals(20, np.f21(20)); /// 02: runtime error | 68 Expect.equals(20, np.f21(20)); //# 02: runtime error |
69 Expect.equals(20, F10(b:20)); | 69 Expect.equals(20, F10(b:20)); |
70 Expect.equals(20, np.f21(b:20)); | 70 Expect.equals(20, np.f21(b:20)); |
71 Expect.equals(1020, F21(10)); | 71 Expect.equals(1020, F21(10)); |
72 Expect.equals(1020, np.f32(10)); | 72 Expect.equals(1020, np.f32(10)); |
73 Expect.equals(1025, F21(10, 25)); /// 03: runtime error | 73 Expect.equals(1025, F21(10, 25)); //# 03: runtime error |
74 Expect.equals(1025, np.f32(10, 25)); /// 04: runtime error | 74 Expect.equals(1025, np.f32(10, 25)); //# 04: runtime error |
75 Expect.equals(1025, F21(10, b:25)); | 75 Expect.equals(1025, F21(10, b:25)); |
76 Expect.equals(1025, np.f32(10, b:25)); | 76 Expect.equals(1025, np.f32(10, b:25)); |
77 Expect.equals(102030, F31(10)); | 77 Expect.equals(102030, F31(10)); |
78 Expect.equals(102030, np.f42(10)); | 78 Expect.equals(102030, np.f42(10)); |
79 Expect.equals(102530, F31(10, 25)); /// 05: runtime error | 79 Expect.equals(102530, F31(10, 25)); //# 05: runtime error |
80 Expect.equals(102530, np.f42(10, 25)); /// 06: runtime error | 80 Expect.equals(102530, np.f42(10, 25)); //# 06: runtime error |
81 Expect.equals(102530, F31(10, b:25)); | 81 Expect.equals(102530, F31(10, b:25)); |
82 Expect.equals(102530, np.f42(10, b:25)); | 82 Expect.equals(102530, np.f42(10, b:25)); |
83 Expect.equals(102035, F31(10, c:35)); | 83 Expect.equals(102035, F31(10, c:35)); |
84 Expect.equals(102035, np.f42(10, c:35)); | 84 Expect.equals(102035, np.f42(10, c:35)); |
85 Expect.equals(102535, F31(10, b:25, c:35)); | 85 Expect.equals(102535, F31(10, b:25, c:35)); |
86 Expect.equals(102535, np.f42(10, b:25, c:35)); | 86 Expect.equals(102535, np.f42(10, b:25, c:35)); |
87 Expect.equals(102535, F31(10, 25, c:35)); /// 07: runtime error | 87 Expect.equals(102535, F31(10, 25, c:35)); //# 07: runtime error |
88 Expect.equals(102535, np.f42(10, 25, c:35)); /// 08: runtime error | 88 Expect.equals(102535, np.f42(10, 25, c:35)); //# 08: runtime error |
89 Expect.equals(102535, F31(10, c:35, b:25)); | 89 Expect.equals(102535, F31(10, c:35, b:25)); |
90 Expect.equals(102535, np.f42(10, c:35, b:25)); | 90 Expect.equals(102535, np.f42(10, c:35, b:25)); |
91 Expect.equals(10200040, F41(10)); | 91 Expect.equals(10200040, F41(10)); |
92 Expect.equals(10200040, np.f52(10)); | 92 Expect.equals(10200040, np.f52(10)); |
93 Expect.equals(10203540, F41(10, c:35)); | 93 Expect.equals(10203540, F41(10, c:35)); |
94 Expect.equals(10203540, np.f52(10, c:35)); | 94 Expect.equals(10203540, np.f52(10, c:35)); |
95 Expect.equals(10250045, F41(10, d:45, b:25)); | 95 Expect.equals(10250045, F41(10, d:45, b:25)); |
96 Expect.equals(10250045, F41(10, 25, d:45)); /// 09: runtime error | 96 Expect.equals(10250045, F41(10, 25, d:45)); //# 09: runtime error |
97 Expect.equals(10250045, np.f52(10, d:45, b:25)); | 97 Expect.equals(10250045, np.f52(10, d:45, b:25)); |
98 Expect.equals(10253545, F41(10, d:45, c:35, b:25)); | 98 Expect.equals(10253545, F41(10, d:45, c:35, b:25)); |
99 Expect.equals(10253545, np.f52(10, d:45, c:35, b:25)); | 99 Expect.equals(10253545, np.f52(10, d:45, c:35, b:25)); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 main() { | 103 main() { |
104 OptionalNamedParametersTest.test(); | 104 OptionalNamedParametersTest.test(); |
105 } | 105 } |
OLD | NEW |