From fb2c821632e043c01cfb7581e83f31514acab2fa Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 22:17:14 +0200 Subject: [PATCH 1/7] Add samples for CharSequence.toContain.exactly #1516 --- .../api/fluent/en_GB/charSequenceToContainCheckers.kt | 3 +++ .../en_GB/samples/CharSequenceToContainCheckerSamples.kt | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt index e6285953c3..330e6aae70 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt @@ -64,6 +64,9 @@ fun AtLeastCheckerStep.butAtMost( * @return The newly created builder. * @throws IllegalArgumentException In case [times] is smaller than zero. * @throws IllegalArgumentException In case [times] is zero; use [notToContain] instead. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCheckerSamples.exactly + * */ fun CharSequenceContains.EntryPointStep.exactly( times: Int diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt index 9f39b3a7a8..44b8e7a9a4 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt @@ -23,4 +23,13 @@ class CharSequenceToContainCheckerSamples { expect("ABBBBCD").toContain.atLeast(2).butAtMost(3).value("B") } } + + @Test + fun exactly() { + expect("ABCBAC").toContain.exactly(2).value("C") + + fails { + expect("ABBBBCD").toContain.exactly(3).value("B") + } + } } From a6488d6f79a00e01f6c80d0c55a0482d26d1e12e Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 22:19:52 +0200 Subject: [PATCH 2/7] Add samples for CharSequence.toContain.atMost #1517 --- .../api/fluent/en_GB/charSequenceToContainCheckers.kt | 3 +++ .../en_GB/samples/CharSequenceToContainCheckerSamples.kt | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt index 330e6aae70..cc69d59831 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt @@ -88,6 +88,9 @@ fun CharSequenceContains.EntryPointStep< * @throws IllegalArgumentException In case [times] is smaller than zero. * @throws IllegalArgumentException In case [times] is zero; use [notToContain] instead. * @throws IllegalArgumentException In case [times] equals to one; use [exactly] instead. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCheckerSamples.atMost + * */ fun CharSequenceContains.EntryPointStep.atMost( times: Int diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt index 44b8e7a9a4..ddb1bc7100 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt @@ -15,6 +15,15 @@ class CharSequenceToContainCheckerSamples { } } + @Test + fun atMost() { + expect("ABBC").toContain.atMost(2).value("B") + + fails { + expect("AABBAA").toContain.atMost(3).value("A") + } + } + @Test fun butAtMost() { expect("ABBC").toContain.atLeast(1).butAtMost(2).value("B") From 99f790e7a746da1bd0d651eb00fe5576eb89f9c5 Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 22:22:17 +0200 Subject: [PATCH 3/7] Add samples for CharSequence.toContain.notOrAtMost #1518 --- .../api/fluent/en_GB/charSequenceToContainCheckers.kt | 3 +++ .../samples/CharSequenceToContainCheckerSamples.kt | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt index cc69d59831..b44da48f26 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCheckers.kt @@ -112,6 +112,9 @@ fun CharSequenceContains.EntryPointStep< * @return The newly created builder. * @throws IllegalArgumentException In case [times] is smaller than zero. * @throws IllegalArgumentException In case [times] is zero; use [notToContain] instead. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCheckerSamples.notOrAtMost + * */ fun CharSequenceContains.EntryPointStep.notOrAtMost( times: Int diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt index ddb1bc7100..50ed9873d9 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCheckerSamples.kt @@ -24,6 +24,16 @@ class CharSequenceToContainCheckerSamples { } } + @Test + fun notOrAtMost() { + expect("ABBC").toContain.notOrAtMost(2).value("D") + expect("ABBC").toContain.notOrAtMost(2).value("B") + + fails { + expect("AABBAA").toContain.notOrAtMost(3).value("A") + } + } + @Test fun butAtMost() { expect("ABBC").toContain.atLeast(1).butAtMost(2).value("B") From f9548f4b40c7897e00b202c82e970c60014dab21 Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 23:54:20 +0200 Subject: [PATCH 4/7] Add samples for CharSequence.toContain...values #1519 --- .../en_GB/charSequenceToContainCreators.kt | 9 ++++ .../CharSequenceToContainCreatorSamples.kt | 44 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt index efd9d19777..d00b9342bc 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt @@ -64,6 +64,9 @@ fun CheckerStep.value(expected: CharS * @return an [Expect] for the subject of `this` expectation. * @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a * [CharSequence], [Number] or [Char]. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.values + * */ fun CheckerStep.values( expected: CharSequenceOrNumberOrChar, @@ -118,6 +121,9 @@ fun CheckerStep.value( * @return an [Expect] for the subject of `this` expectation. * @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a * [CharSequence], [Number] or [Char]. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.valuesIgnoringCaseWithChecker + * */ @JvmName("valuesIgnoringCase") fun CheckerStep.values( @@ -169,6 +175,9 @@ fun EntryPointStep.value( * @return an [Expect] for the subject of `this` expectation. * @throws IllegalArgumentException in case [expected] or one of the [otherExpected] is not a * [CharSequence], [Number] or [Char]. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.valuesIgnoringCase + * */ fun EntryPointStep.values( expected: CharSequenceOrNumberOrChar, diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt index 68224e7342..048e2bd3d7 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt @@ -19,4 +19,48 @@ class CharSequenceToContainCreatorSamples { expect("AAAAAA").toContain.atMost(3).value("A") } } + + @Test + fun values() { + expect("ABC").toContain.exactly(1).values("A", "B", "C") + expect("AAABC").toContain.atMost(3).values("A", "B", "C") + expect("ABBBCD").toContain.atLeast(1).values("A", "B", "C", "D") + fails { + expect("AAAAAABBBB").toContain.atMost(3).values("A", "B") + } + + fails { + expect("AAABBBB").toContain.exactly(3).values("A", "B") + } + + fails { + expect("AAAAAABBBB").toContain.atLeast(3).values("A", "B", "C") + } + } + + @Test + fun valuesIgnoringCase() { + expect("AbC").toContain.ignoringCase.values("A", "B", "c") + fails { + expect("aabaabbb").toContain.ignoringCase.values("A", "B", "C") + } + } + + @Test + fun valuesIgnoringCaseWithChecker() { + expect("ABc").toContain.ignoringCase.exactly(1).values("A", "b", "C") + expect("AaaBC").toContain.ignoringCase.atMost(3).values("A", "B", "c") + expect("ABBBcD").toContain.ignoringCase.atLeast(1).values("a", "b", "C", "d") + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atMost(3).values("a", "b") + } + + fails { + expect("AAABBBB").toContain.ignoringCase.exactly(3).values("A", "b") + } + + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).values("a", "b", "C") + } + } } From f95fd933d73be2ea3c1d9d4361525fe37bedcc22 Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 22:50:20 +0200 Subject: [PATCH 5/7] Add samples for CharSequence.toContain...value #1520 --- .../en_GB/charSequenceToContainCreators.kt | 7 +++++ .../CharSequenceToContainCreatorSamples.kt | 28 +++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt index d00b9342bc..317285b995 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt @@ -35,6 +35,7 @@ import kotlin.jvm.JvmName * @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char]. * * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.value + * */ fun CheckerStep.value(expected: CharSequenceOrNumberOrChar): Expect = values(expected) @@ -90,6 +91,9 @@ fun CheckerStep.values( * * @return an [Expect] for the subject of `this` expectation. * @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char]. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.valueIgnoringCaseWithChecker + * */ @JvmName("valueIgnoringCase") fun CheckerStep.value( @@ -148,6 +152,9 @@ fun CheckerStep.values( * * @return an [Expect] for the subject of `this` expectation. * @throws IllegalArgumentException in case [expected] is not a [CharSequence], [Number] or [Char]. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.valueIgnoringCase + * */ fun EntryPointStep.value( expected: CharSequenceOrNumberOrChar diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt index 048e2bd3d7..c1db321280 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt @@ -20,6 +20,34 @@ class CharSequenceToContainCreatorSamples { } } + @Test + fun valueIgnoringCase() { + expect("ABC").toContain.ignoringCase.value("a") + expect("AbbbC").toContain.ignoringCase.value("B") + + fails { + expect("AAAAAA").toContain.ignoringCase.value("B") + } + } + + @Test + fun valueIgnoringCaseWithChecker() { + expect("ABC").toContain.ignoringCase.exactly(1).value("A") + expect("AAABBC").toContain.ignoringCase.atMost(3).value("b") + expect("aBBBCD").toContain.ignoringCase.atLeast(1).value("A") + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atMost(3).value("A") + } + + fails { + expect("AAABBBb").toContain.ignoringCase.exactly(3).value("b") + } + + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).value("D") + } + } + @Test fun values() { expect("ABC").toContain.exactly(1).values("A", "B", "C") From 3409d1f68b5db6f5377d8d5137ecec2ea230f35d Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 22:56:19 +0200 Subject: [PATCH 6/7] Add samples for CharSequence.toContain...regex/matchFor #1521 --- .../en_GB/charSequenceToContainCreators.kt | 12 ++++ .../CharSequenceToContainCreatorSamples.kt | 62 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt index 317285b995..316a7dfffd 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt @@ -210,6 +210,9 @@ fun EntryPointStep.values( * @param otherPatterns Additional patterns which are expected to have a match against the input of the search. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.regex + * */ fun CheckerStep.regex( pattern: String, @@ -268,6 +271,9 @@ fun CheckerStep.regex( * @return an [Expect] for the subject of `this` expectation. * * @since 1.1.0 + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.matchFor + * */ fun CheckerStep.matchFor( pattern: Regex, @@ -293,6 +299,9 @@ fun CheckerStep.matchFor( * @param otherPatterns Additional patterns which are expected to have a match against the input of the search. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.regexIgnoringCaseWithChecker + * */ @JvmName("regexIgnoringCase") fun CheckerStep.regex( @@ -322,6 +331,9 @@ fun CheckerStep.regex( * @param otherPatterns Additional patterns which are expected to have a match against the input of the search. * * @return an [Expect] for the subject of `this` expectation. + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.regexIgnoringCase + * */ fun EntryPointStep.regex( pattern: String, diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt index c1db321280..921566905e 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt @@ -91,4 +91,66 @@ class CharSequenceToContainCreatorSamples { expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).values("a", "b", "C") } } + + @Test + fun regex() { + expect("ABC").toContain.exactly(1).regex("A", "B", "C") + expect("AAABC").toContain.atMost(3).regex("A", "B", "C") + expect("ABBBCD").toContain.atLeast(1).regex("A", "B", "C", "D") + fails { + expect("AAAAAABBBB").toContain.atMost(3).regex("A", "B") + } + + fails { + expect("AAABBBB").toContain.exactly(3).regex("A", "B") + } + + fails { + expect("AAAAAABBBB").toContain.atLeast(3).regex("A", "B", "C") + } + } + + @Test + fun regexIgnoringCase() { + expect("AbC").toContain.ignoringCase.regex("A", "B", "c") + fails { + expect("aabaabbb").toContain.ignoringCase.regex("A", "B", "C") + } + } + + @Test + fun regexIgnoringCaseWithChecker() { + expect("ABc").toContain.ignoringCase.exactly(1).regex("A", "b", "C") + expect("AaaBC").toContain.ignoringCase.atMost(3).regex("A", "B", "c") + expect("ABBBcD").toContain.ignoringCase.atLeast(1).regex("a", "b", "C", "d") + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atMost(3).regex("a", "b") + } + + fails { + expect("AAABBBB").toContain.ignoringCase.exactly(3).regex("A", "b") + } + + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).regex("a", "b", "C") + } + } + + @Test + fun matchFor() { + expect("ABC").toContain.exactly(1).matchFor(Regex("A"), Regex("B"), Regex("C")) + expect("AAABC").toContain.atMost(3).matchFor(Regex("A"), Regex("B"), Regex("C")) + expect("ABBBCD").toContain.atLeast(1).matchFor(Regex("A"), Regex("B"), Regex("C"), Regex("D")) + fails { + expect("AAAAAABBBB").toContain.atMost(3).matchFor(Regex("A"), Regex("B")) + } + + fails { + expect("AAABBBB").toContain.exactly(3).matchFor(Regex("A"), Regex("B")) + } + + fails { + expect("AAAAAABBBB").toContain.atLeast(3).matchFor(Regex("A"), Regex("B"), Regex("C")) + } + } } From ba88bab0436170016652cf7ae2c46dc39a238a20 Mon Sep 17 00:00:00 2001 From: Nikos-Tsiougranas Date: Tue, 29 Aug 2023 23:50:57 +0200 Subject: [PATCH 7/7] Add samples for CharSequence.toContain...elementsOf #1522 --- .../en_GB/charSequenceToContainCreators.kt | 8 ++++ .../CharSequenceToContainCreatorSamples.kt | 45 +++++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt index 316a7dfffd..42070f0565 100644 --- a/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt +++ b/apis/fluent/atrium-api-fluent/src/commonMain/kotlin/ch/tutteli/atrium/api/fluent/en_GB/charSequenceToContainCreators.kt @@ -359,6 +359,9 @@ fun EntryPointStep.regex( * [expectedIterableLike] does not have elements (is empty). * * @since 0.13.0 + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.elementsOf + * */ fun CheckerStep.elementsOf( expectedIterableLike: IterableLike @@ -385,6 +388,8 @@ fun CheckerStep.elementsOf( * @throws IllegalArgumentException in case [expectedIterableLike] is not an [Iterable], [Sequence] or one of the [Array] types or the given * [expectedIterableLike] does not have elements (is empty). * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.elementsOfIgnoringCaseWithChecker + * * @since 0.13.0 */ @JvmName("elementsOfIgnoringCase") @@ -413,6 +418,9 @@ fun CheckerStep.elementsOf( * [expectedIterableLike] does not have elements (is empty). * * @since 0.13.0 + * + * @sample ch.tutteli.atrium.api.fluent.en_GB.samples.CharSequenceToContainCreatorSamples.elementsOfIgnoreCase + * */ @JvmName("elementsOfIgnoringCase") fun EntryPointStep.elementsOf( diff --git a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt index 921566905e..ab323753b8 100644 --- a/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt +++ b/apis/fluent/atrium-api-fluent/src/commonTest/kotlin/ch/tutteli/atrium/api/fluent/en_GB/samples/CharSequenceToContainCreatorSamples.kt @@ -153,4 +153,49 @@ class CharSequenceToContainCreatorSamples { expect("AAAAAABBBB").toContain.atLeast(3).matchFor(Regex("A"), Regex("B"), Regex("C")) } } + + + @Test + fun elementsOf() { + expect("ABC").toContain.exactly(1).elementsOf(listOf("A", "B", "C")) + expect("AAABC").toContain.atMost(3).elementsOf(listOf("A", "B", "C")) + expect("ABBBCD").toContain.atLeast(1).elementsOf(listOf("A", "B", "C", "D")) + fails { + expect("AAAAAABBBB").toContain.atMost(3).elementsOf(listOf("A", "B")) + } + + fails { + expect("AAABBBB").toContain.exactly(3).elementsOf(listOf("A", "B")) + } + + fails { + expect("AAAAAABBBB").toContain.atLeast(3).elementsOf(listOf("A", "B", "C")) + } + } + + @Test + fun elementsOfIgnoreCase() { + expect("AbC").toContain.ignoringCase.elementsOf(listOf("A", "B", "c")) + fails { + expect("aabaabbb").toContain.ignoringCase.elementsOf(listOf("A", "B", "C")) + } + } + + @Test + fun elementsOfIgnoringCaseWithChecker() { + expect("ABc").toContain.ignoringCase.exactly(1).elementsOf(listOf("A", "b", "C")) + expect("AaaBC").toContain.ignoringCase.atMost(3).elementsOf(listOf("A", "B", "c")) + expect("ABBBcD").toContain.ignoringCase.atLeast(1).elementsOf(listOf("a", "b", "C", "d")) + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atMost(3).elementsOf(listOf("a", "b")) + } + + fails { + expect("AAABBBB").toContain.ignoringCase.exactly(3).elementsOf(listOf("A", "b")) + } + + fails { + expect("AAAAAABBBB").toContain.ignoringCase.atLeast(3).elementsOf(listOf("a", "b", "C")) + } + } }