-
Notifications
You must be signed in to change notification settings - Fork 2
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
Sylwester Zieliński
committed
Nov 13, 2023
1 parent
fc3e816
commit 4bebc0e
Showing
4 changed files
with
117 additions
and
3 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
30 changes: 30 additions & 0 deletions
30
core/src/androidTest/java/no/nordicsemi/android/common/core/SparseArrayExtTest.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package no.nordicsemi.android.common.core | ||
|
||
import android.util.SparseArray | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import kotlin.test.assertEquals | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
class SparseArrayExtTest { | ||
|
||
@Test | ||
fun whenMapSparseArrayShouldReturnArrayWithMappedValues() { | ||
val array = SparseArray<String>() | ||
|
||
array.put(0, "aaa") | ||
array.put(2, "bbb") | ||
array.put(10, "ccc") | ||
|
||
val newArray = array.map { "ddd" } | ||
|
||
val expectedArray = SparseArray<String>().apply { | ||
put(0, "ddd") | ||
put(2, "ddd") | ||
put(10, "ddd") | ||
} | ||
|
||
assertEquals(true, newArray.contentEquals(expectedArray)) | ||
} | ||
} |
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