-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
110 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 11 additions & 1 deletion
12
kactoos-common/src/test/kotlin/nnl/rocks/kactoos/collection/ShuffledTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,26 @@ | ||
package nnl.rocks.kactoos.collection | ||
|
||
import nnl.rocks.kactoos.iterable.IterableOf | ||
import kotlin.test.Test | ||
import kotlin.test.assertTrue | ||
|
||
class ShuffledTest { | ||
|
||
@Test | ||
fun shuffles() { | ||
fun shufflesVarargs() { | ||
val shuffled = Shuffled(1, 2, 3) | ||
assertTrue(shuffled.size == 3) | ||
assertTrue(shuffled.contains(1)) | ||
assertTrue(shuffled.contains(2)) | ||
assertTrue(shuffled.contains(3)) | ||
} | ||
|
||
@Test | ||
fun shufflesIterable() { | ||
val shuffled = Shuffled(IterableOf(1, 2, 3)) | ||
assertTrue(shuffled.size == 3) | ||
assertTrue(shuffled.contains(1)) | ||
assertTrue(shuffled.contains(2)) | ||
assertTrue(shuffled.contains(3)) | ||
} | ||
} |
33 changes: 32 additions & 1 deletion
33
kactoos-common/src/test/kotlin/nnl/rocks/kactoos/collection/SortedTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,46 @@ | ||
package nnl.rocks.kactoos.collection | ||
|
||
import nnl.rocks.kactoos.iterable.IterableOf | ||
import nnl.rocks.kactoos.test.BehavesAsCollection | ||
import kotlin.test.Test | ||
|
||
class SortedTest { | ||
|
||
@Test | ||
fun sorts() { | ||
fun sortsNaturalVarargs() { | ||
BehavesAsCollection( | ||
Sorted(3, 2, 1), | ||
arrayOf(1, 2, 3) | ||
) | ||
} | ||
|
||
@Test | ||
fun sortsNaturalIterable() { | ||
BehavesAsCollection( | ||
Sorted(IterableOf(3, 2, 1)), | ||
arrayOf(1, 2, 3) | ||
) | ||
} | ||
|
||
@Test | ||
fun sortsVarargs() { | ||
BehavesAsCollection( | ||
Sorted( | ||
Comparator { a: Int, b: Int -> a.compareTo(b) }, | ||
3, 2, 1 | ||
), | ||
arrayOf(1, 2, 3) | ||
) | ||
} | ||
|
||
@Test | ||
fun sortsIterable() { | ||
BehavesAsCollection( | ||
Sorted( | ||
Comparator { a: Int, b: Int -> a.compareTo(b) }, | ||
IterableOf(3, 2, 1) | ||
), | ||
arrayOf(1, 2, 3) | ||
) | ||
} | ||
} |