Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved #676 #830

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import ch.tutteli.atrium.logic.*
* The comparison is carried out with [Comparable.compareTo].
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isLessThan
*/
infix fun <T : Comparable<T>> Expect<T>.isLessThan(expected: T): Expect<T> =
_logicAppend { isLessThan(expected) }
Expand All @@ -17,6 +19,8 @@ infix fun <T : Comparable<T>> Expect<T>.isLessThan(expected: T): Expect<T> =
* The comparison is carried out with [Comparable.compareTo].
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isLessThanOrEqual
*/
infix fun <T : Comparable<T>> Expect<T>.isLessThanOrEqual(expected: T): Expect<T> =
_logicAppend { isLessThanOrEqual(expected) }
Expand All @@ -26,6 +30,8 @@ infix fun <T : Comparable<T>> Expect<T>.isLessThanOrEqual(expected: T): Expect<T
* The comparison is carried out with [Comparable.compareTo].
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isGreaterThan
*/
infix fun <T : Comparable<T>> Expect<T>.isGreaterThan(expected: T): Expect<T> =
_logicAppend { isGreaterThan(expected) }
Expand All @@ -35,6 +41,8 @@ infix fun <T : Comparable<T>> Expect<T>.isGreaterThan(expected: T): Expect<T> =
* The comparison is carried out with [Comparable.compareTo].
*
* @return an [Expect] for the subject of `this` expectation.
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isGreaterThanOrEqual
*/
infix fun <T : Comparable<T>> Expect<T>.isGreaterThanOrEqual(expected: T): Expect<T> =
_logicAppend { isGreaterThanOrEqual(expected) }
Expand All @@ -46,6 +54,8 @@ infix fun <T : Comparable<T>> Expect<T>.isGreaterThanOrEqual(expected: T): Expec
* @return an [Expect] for the subject of `this` expectation.
*
* @since 0.13.0
*
* @sample ch.tutteli.atrium.api.infix.en_GB.samples.deprecated.ComparableAssertionSamples.isEqualComparingTo
*/
infix fun <T : Comparable<T>> Expect<T>.isEqualComparingTo(expected: T): Expect<T> =
_logicAppend { isEqualComparingTo(expected) }
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//TODO remove file with 1.0.0
@file:Suppress("DEPRECATION")

package ch.tutteli.atrium.api.infix.en_GB.samples.deprecated

import ch.tutteli.atrium.api.infix.en_GB.isEqualComparingTo
import ch.tutteli.atrium.api.infix.en_GB.isGreaterThan
import ch.tutteli.atrium.api.infix.en_GB.isLessThan
import ch.tutteli.atrium.api.infix.en_GB.isLessThanOrEqual
import ch.tutteli.atrium.api.infix.en_GB.samples.fails
import ch.tutteli.atrium.api.verbs.internal.expect
import kotlin.test.Test

class ComparableAssertionSamples {

@Test
fun isLessThan() {
expect(1) isLessThan 2

fails {
expect(2) isLessThan 1
}
}

@Test
fun isLessThanOrEqual() {
expect(1) isLessThanOrEqual 2
expect(2) isLessThanOrEqual 2

fails {
expect(2) isLessThanOrEqual 1
}
}

@Test
fun isGreaterThan() {
expect(2) isGreaterThan 1

fails {
expect(2) isGreaterThan 2
}
}

@Test
fun isGreaterThanOrEqual() {
expect(2) isEqualComparingTo 2

fails {
expect(1) isEqualComparingTo 2
expect(2) isEqualComparingTo 1
}
}

@Test
fun isEqualComparingTo() {
expect(2) isEqualComparingTo 2

fails {
expect(1) isEqualComparingTo 2
expect(2) isEqualComparingTo 1
}
}
}