OLD | NEW |
(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 import 'package:matcher/matcher.dart'; |
| 6 import 'package:test/test.dart'; |
| 7 |
| 8 import 'test_utils.dart'; |
| 9 |
| 10 void main() { |
| 11 test('greaterThan', () { |
| 12 shouldPass(10, greaterThan(9)); |
| 13 shouldFail( |
| 14 9, |
| 15 greaterThan(10), |
| 16 "Expected: a value greater than <10> " |
| 17 "Actual: <9> " |
| 18 "Which: is not a value greater than <10>"); |
| 19 }); |
| 20 |
| 21 test('greaterThanOrEqualTo', () { |
| 22 shouldPass(10, greaterThanOrEqualTo(10)); |
| 23 shouldFail( |
| 24 9, |
| 25 greaterThanOrEqualTo(10), |
| 26 "Expected: a value greater than or equal to <10> " |
| 27 "Actual: <9> " |
| 28 "Which: is not a value greater than or equal to <10>"); |
| 29 }); |
| 30 |
| 31 test('lessThan', () { |
| 32 shouldFail( |
| 33 10, |
| 34 lessThan(9), |
| 35 "Expected: a value less than <9> " |
| 36 "Actual: <10> " |
| 37 "Which: is not a value less than <9>"); |
| 38 shouldPass(9, lessThan(10)); |
| 39 }); |
| 40 |
| 41 test('lessThanOrEqualTo', () { |
| 42 shouldPass(10, lessThanOrEqualTo(10)); |
| 43 shouldFail( |
| 44 11, |
| 45 lessThanOrEqualTo(10), |
| 46 "Expected: a value less than or equal to <10> " |
| 47 "Actual: <11> " |
| 48 "Which: is not a value less than or equal to <10>"); |
| 49 }); |
| 50 |
| 51 test('isZero', () { |
| 52 shouldPass(0, isZero); |
| 53 shouldFail( |
| 54 1, |
| 55 isZero, |
| 56 "Expected: a value equal to <0> " |
| 57 "Actual: <1> " |
| 58 "Which: is not a value equal to <0>"); |
| 59 }); |
| 60 |
| 61 test('isNonZero', () { |
| 62 shouldFail( |
| 63 0, |
| 64 isNonZero, |
| 65 "Expected: a value not equal to <0> " |
| 66 "Actual: <0> " |
| 67 "Which: is not a value not equal to <0>"); |
| 68 shouldPass(1, isNonZero); |
| 69 }); |
| 70 |
| 71 test('isPositive', () { |
| 72 shouldFail( |
| 73 -1, |
| 74 isPositive, |
| 75 "Expected: a positive value " |
| 76 "Actual: <-1> " |
| 77 "Which: is not a positive value"); |
| 78 shouldFail( |
| 79 0, |
| 80 isPositive, |
| 81 "Expected: a positive value " |
| 82 "Actual: <0> " |
| 83 "Which: is not a positive value"); |
| 84 shouldPass(1, isPositive); |
| 85 }); |
| 86 |
| 87 test('isNegative', () { |
| 88 shouldPass(-1, isNegative); |
| 89 shouldFail( |
| 90 0, |
| 91 isNegative, |
| 92 "Expected: a negative value " |
| 93 "Actual: <0> " |
| 94 "Which: is not a negative value"); |
| 95 }); |
| 96 |
| 97 test('isNonPositive', () { |
| 98 shouldPass(-1, isNonPositive); |
| 99 shouldPass(0, isNonPositive); |
| 100 shouldFail( |
| 101 1, |
| 102 isNonPositive, |
| 103 "Expected: a non-positive value " |
| 104 "Actual: <1> " |
| 105 "Which: is not a non-positive value"); |
| 106 }); |
| 107 |
| 108 test('isNonNegative', () { |
| 109 shouldPass(1, isNonNegative); |
| 110 shouldPass(0, isNonNegative); |
| 111 shouldFail( |
| 112 -1, |
| 113 isNonNegative, |
| 114 "Expected: a non-negative value " |
| 115 "Actual: <-1> " |
| 116 "Which: is not a non-negative value"); |
| 117 }); |
| 118 } |
OLD | NEW |