| 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 import 'package:matcher/matcher.dart'; | 5 import 'package:matcher/matcher.dart'; |
| 6 import 'package:test/test.dart' show test, group; | 6 import 'package:test/test.dart' show test; |
| 7 | 7 |
| 8 import 'test_utils.dart'; | 8 import 'test_utils.dart'; |
| 9 | 9 |
| 10 void main() { | 10 void main() { |
| 11 test('greaterThan', () { | 11 test('greaterThan', () { |
| 12 shouldPass(10, greaterThan(9)); | 12 shouldPass(10, greaterThan(9)); |
| 13 shouldFail(9, greaterThan(10), "Expected: a value greater than <10> " | 13 shouldFail(9, greaterThan(10), "Expected: a value greater than <10> " |
| 14 "Actual: <9> " | 14 "Actual: <9> " |
| 15 "Which: is not a value greater than <10>"); | 15 "Which: is not a value greater than <10>"); |
| 16 }); | 16 }); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 "Which: is not a non-positive value"); | 77 "Which: is not a non-positive value"); |
| 78 }); | 78 }); |
| 79 | 79 |
| 80 test('isNonNegative', () { | 80 test('isNonNegative', () { |
| 81 shouldPass(1, isNonNegative); | 81 shouldPass(1, isNonNegative); |
| 82 shouldPass(0, isNonNegative); | 82 shouldPass(0, isNonNegative); |
| 83 shouldFail(-1, isNonNegative, "Expected: a non-negative value " | 83 shouldFail(-1, isNonNegative, "Expected: a non-negative value " |
| 84 "Actual: <-1> " | 84 "Actual: <-1> " |
| 85 "Which: is not a non-negative value"); | 85 "Which: is not a non-negative value"); |
| 86 }); | 86 }); |
| 87 | |
| 88 test('closeTo', () { | |
| 89 shouldPass(0, closeTo(0, 1)); | |
| 90 shouldPass(-1, closeTo(0, 1)); | |
| 91 shouldPass(1, closeTo(0, 1)); | |
| 92 shouldFail(1.001, closeTo(0, 1), | |
| 93 "Expected: a numeric value within <1> of <0> " | |
| 94 "Actual: <1.001> " | |
| 95 "Which: differs by <1.001>"); | |
| 96 shouldFail(-1.001, closeTo(0, 1), | |
| 97 "Expected: a numeric value within <1> of <0> " | |
| 98 "Actual: <-1.001> " | |
| 99 "Which: differs by <1.001>"); | |
| 100 }); | |
| 101 | |
| 102 test('inInclusiveRange', () { | |
| 103 shouldFail(-1, inInclusiveRange(0, 2), | |
| 104 "Expected: be in range from 0 (inclusive) to 2 (inclusive) " | |
| 105 "Actual: <-1>"); | |
| 106 shouldPass(0, inInclusiveRange(0, 2)); | |
| 107 shouldPass(1, inInclusiveRange(0, 2)); | |
| 108 shouldPass(2, inInclusiveRange(0, 2)); | |
| 109 shouldFail(3, inInclusiveRange(0, 2), | |
| 110 "Expected: be in range from 0 (inclusive) to 2 (inclusive) " | |
| 111 "Actual: <3>"); | |
| 112 }); | |
| 113 | |
| 114 test('inExclusiveRange', () { | |
| 115 shouldFail(0, inExclusiveRange(0, 2), | |
| 116 "Expected: be in range from 0 (exclusive) to 2 (exclusive) " | |
| 117 "Actual: <0>"); | |
| 118 shouldPass(1, inExclusiveRange(0, 2)); | |
| 119 shouldFail(2, inExclusiveRange(0, 2), | |
| 120 "Expected: be in range from 0 (exclusive) to 2 (exclusive) " | |
| 121 "Actual: <2>"); | |
| 122 }); | |
| 123 | |
| 124 test('inOpenClosedRange', () { | |
| 125 shouldFail(0, inOpenClosedRange(0, 2), | |
| 126 "Expected: be in range from 0 (exclusive) to 2 (inclusive) " | |
| 127 "Actual: <0>"); | |
| 128 shouldPass(1, inOpenClosedRange(0, 2)); | |
| 129 shouldPass(2, inOpenClosedRange(0, 2)); | |
| 130 }); | |
| 131 | |
| 132 test('inClosedOpenRange', () { | |
| 133 shouldPass(0, inClosedOpenRange(0, 2)); | |
| 134 shouldPass(1, inClosedOpenRange(0, 2)); | |
| 135 shouldFail(2, inClosedOpenRange(0, 2), | |
| 136 "Expected: be in range from 0 (inclusive) to 2 (exclusive) " | |
| 137 "Actual: <2>"); | |
| 138 }); | |
| 139 } | 87 } |
| OLD | NEW |