diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/bigDecimalExpectations.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/bigDecimalExpectations.kt index 556f22c8c9..53da468f80 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/bigDecimalExpectations.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/main/kotlin/ch/tutteli/atrium/api/fluent/en_GB/bigDecimalExpectations.kt @@ -84,6 +84,8 @@ fun Expect.toEqual(expected: Nothing?): Expect = * ``` * However, if you expect it to be wrong (because `BigDecimal.scale` differ), then use [notToEqualIncludingScale]. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.BigDecimalExpectationSamples.notToEqual + * * @since 0.17.0 */ @Deprecated( @@ -113,6 +115,8 @@ fun Expect.notToEqual(expected: T): Nothing = * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.BigDecimalExpectationSamples.toEqualNumerically + * * @since 0.17.0 */ fun Expect.toEqualNumerically(expected: T): Expect = @@ -132,6 +136,8 @@ fun Expect.toEqualNumerically(expected: T): Expect = * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.BigDecimalExpectationSamples.notToEqualNumerically + * * @since 0.17.0 */ fun Expect.notToEqualNumerically(expected: T): Expect = @@ -148,6 +154,8 @@ fun Expect.notToEqualNumerically(expected: T): Expect = * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.BigDecimalExpectationSamples.toEqualIncludingScale + * * @since 0.17.0 */ fun Expect.toEqualIncludingScale(expected: T): Expect = @@ -164,6 +172,8 @@ fun Expect.toEqualIncludingScale(expected: T): Expect = * * @return an [Expect] for the subject of `this` expectation. * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.BigDecimalExpectationSamples.notToEqualIncludingScale + * * @since 0.17.0 */ fun Expect.notToEqualIncludingScale(expected: T): Expect = diff --git a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/BigDecimalExpectationSamples.kt b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/BigDecimalExpectationSamples.kt index 5054d0de91..008389b11c 100644 --- a/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/BigDecimalExpectationSamples.kt +++ b/apis/fluent-en_GB/atrium-api-fluent-en_GB-jvm/src/test/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/BigDecimalExpectationSamples.kt @@ -1,6 +1,6 @@ package ch.tutteli.atrium.api.fluent.en_GB.samples -import ch.tutteli.atrium.api.fluent.en_GB.toEqual +import ch.tutteli.atrium.api.fluent.en_GB.* import ch.tutteli.atrium.api.verbs.internal.expect import java.math.BigDecimal import kotlin.test.Test @@ -12,4 +12,68 @@ class BigDecimalExpectationSamples { // only use toEqual to check against null, otherwise use toEqualNumerically or toEqualIncludingScale expect(null as BigDecimal?).toEqual(null) } + + + @Test + fun notToEqual() { + // only use notToEqual to check against null, otherwise use notToEqualNumerically or notToEqualIncludingScale + expect(null as BigDecimal?).notToEqual(BigDecimal("-12345.6789")) + expect(null as BigDecimal?).notToEqual(BigDecimal("1.0")) + expect(null as BigDecimal?).notToEqual(BigDecimal("25.0")) + + + expect(null as BigDecimal?).notToEqual(BigDecimal(-12345.6789)) + expect(null as BigDecimal?).notToEqual(BigDecimal(1.0)) + expect(null as BigDecimal?).notToEqual(BigDecimal(25.0)) + } + + + @Test + fun toEqualNumerically() { + expect(BigDecimal("10")).toEqualNumerically(BigDecimal("10.0")) + expect(BigDecimal("1213669989183")).toEqualNumerically(BigDecimal("1213669989183")) + expect(BigDecimal("1238126387123")).toEqualNumerically(BigDecimal("1238126387123")) + + + expect(BigDecimal(10)).toEqualNumerically(BigDecimal(10.0)) + expect(BigDecimal(1213669989183)).toEqualNumerically(BigDecimal(1213669989183)) + expect(BigDecimal(1238126387123)).toEqualNumerically(BigDecimal(1238126387123)) + } + + + @Test + fun notToEqualNumerically() { + expect(BigDecimal("10")).notToEqualNumerically(BigDecimal("1213669989183")) + expect(BigDecimal("1213669989183")).notToEqualNumerically(BigDecimal("10")) + expect(BigDecimal("1238126387123")).notToEqualNumerically(BigDecimal("-1.0")) + + expect(BigDecimal(10)).notToEqualNumerically(BigDecimal(1213669989183)) + expect(BigDecimal(1213669989183)).notToEqualNumerically(BigDecimal(10)) + expect(BigDecimal(1238126387123)).notToEqualNumerically(BigDecimal(-1.0)) + } + + + @Test + fun toEqualIncludingScale() { + expect(BigDecimal("10.0")).toEqualIncludingScale(BigDecimal("10.0")) + expect(BigDecimal("456.0")).toEqualIncludingScale(BigDecimal("456.0")) + expect(BigDecimal("-1.456")).toEqualIncludingScale(BigDecimal("-1.456")) + + expect(BigDecimal(10.0)).toEqualIncludingScale(BigDecimal(10.0)) + expect(BigDecimal(456.0)).toEqualIncludingScale(BigDecimal(456.0)) + } + + + @Test + fun notToEqualIncludingScale() { + expect(BigDecimal("10")).notToEqualIncludingScale(BigDecimal("10.0")) + expect(BigDecimal("456.0")).notToEqualIncludingScale(BigDecimal("456")) + expect(BigDecimal("-1.456")).notToEqualIncludingScale(BigDecimal("-1.45")) + + expect(BigDecimal(10)).notToEqualIncludingScale(BigDecimal(10.01)) + expect(BigDecimal(456.01)).notToEqualIncludingScale(BigDecimal(456)) + expect(BigDecimal(-1.456)).notToEqualIncludingScale(BigDecimal(-1.45)) + } + + }