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 | 4 |
5 /** | 5 /** |
6 * Returns a matcher which matches if the match argument is greater | 6 * Returns a matcher which matches if the match argument is greater |
7 * than the given [value]. | 7 * than the given [value]. |
8 */ | 8 */ |
9 Matcher greaterThan(value) => | 9 Matcher greaterThan(value) => |
10 new _OrderingComparison(value, false, false, true, 'a value greater than'); | 10 new _OrderingComparison(value, false, false, true, 'a value greater than'); |
(...skipping 17 matching lines...) Expand all Loading... |
28 * Returns a matcher which matches if the match argument is less | 28 * Returns a matcher which matches if the match argument is less |
29 * than or equal to the given [value]. | 29 * than or equal to the given [value]. |
30 */ | 30 */ |
31 Matcher lessThanOrEqualTo(value) => | 31 Matcher lessThanOrEqualTo(value) => |
32 new _OrderingComparison(value, true, true, false, | 32 new _OrderingComparison(value, true, true, false, |
33 'a value less than or equal to'); | 33 'a value less than or equal to'); |
34 | 34 |
35 /** | 35 /** |
36 * A matcher which matches if the match argument is zero. | 36 * A matcher which matches if the match argument is zero. |
37 */ | 37 */ |
38 final Matcher isZero = | 38 const Matcher isZero = |
39 const _OrderingComparison(0, true, false, false, 'a value equal to'); | 39 const _OrderingComparison(0, true, false, false, 'a value equal to'); |
40 | 40 |
41 | 41 |
42 /** | 42 /** |
43 * A matcher which matches if the match argument is non-zero. | 43 * A matcher which matches if the match argument is non-zero. |
44 */ | 44 */ |
45 final Matcher isNonZero = | 45 const Matcher isNonZero = |
46 const _OrderingComparison(0, false, true, true, 'a value not equal to'); | 46 const _OrderingComparison(0, false, true, true, 'a value not equal to'); |
47 | 47 |
48 /** | 48 /** |
49 * A matcher which matches if the match argument is positive. | 49 * A matcher which matches if the match argument is positive. |
50 */ | 50 */ |
51 final Matcher isPositive = | 51 const Matcher isPositive = |
52 const _OrderingComparison(0, false, false, true, 'a positive value', false); | 52 const _OrderingComparison(0, false, false, true, 'a positive value', false); |
53 | 53 |
54 /** | 54 /** |
55 * A matcher which matches if the match argument is zero or negative. | 55 * A matcher which matches if the match argument is zero or negative. |
56 */ | 56 */ |
57 final Matcher isNonPositive = | 57 const Matcher isNonPositive = |
58 const _OrderingComparison(0, true, true, false, | 58 const _OrderingComparison(0, true, true, false, |
59 'a non-positive value', false); | 59 'a non-positive value', false); |
60 | 60 |
61 /** | 61 /** |
62 * A matcher which matches if the match argument is negative. | 62 * A matcher which matches if the match argument is negative. |
63 */ | 63 */ |
64 final Matcher isNegative = | 64 const Matcher isNegative = |
65 const _OrderingComparison(0, false, true, false, 'a negative value', false); | 65 const _OrderingComparison(0, false, true, false, 'a negative value', false); |
66 | 66 |
67 /** | 67 /** |
68 * A matcher which matches if the match argument is zero or positive. | 68 * A matcher which matches if the match argument is zero or positive. |
69 */ | 69 */ |
70 final Matcher isNonNegative = | 70 const Matcher isNonNegative = |
71 const _OrderingComparison(0, true, false, true, | 71 const _OrderingComparison(0, true, false, true, |
72 'a non-negative value', false); | 72 'a non-negative value', false); |
73 | 73 |
74 bool _isNumeric(value) { | 74 bool _isNumeric(value) { |
75 return value is int || value is double; | 75 return value is int || value is double; |
76 } | 76 } |
77 | 77 |
78 class _OrderingComparison extends BaseMatcher { | 78 class _OrderingComparison extends BaseMatcher { |
79 /** Expected value. */ | 79 /** Expected value. */ |
80 final _value; | 80 final _value; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 return mismatchDescription. | 220 return mismatchDescription. |
221 addDescriptionOf(item). | 221 addDescriptionOf(item). |
222 add(' not numeric'); | 222 add(' not numeric'); |
223 } else { | 223 } else { |
224 return super.describeMismatch(item, mismatchDescription, | 224 return super.describeMismatch(item, mismatchDescription, |
225 matchState, verbose); | 225 matchState, verbose); |
226 } | 226 } |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
OLD | NEW |