Skip to content

Commit 702c298

Browse files
authored
update for bulk test (#112)
1 parent bdb3bed commit 702c298

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
77
workflow_dispatch:
88

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
kotlin.code.style=official
22
kotlin.incremental.wasm=true
3-
kotlin.daemon.jvmargs=-Xmx2048M
3+
kotlin.daemon.jvmargs=-Xmx4096M
44
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
55
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true
66
org.gradle.configuration-cache=false
7-
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
7+
org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8

src/commonMain/kotlin/dev/sargunv/pokekotlin/model/locations.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ data class Region(
5858
val id: Int,
5959
val name: String,
6060
val locations: List<NamedApiResource>,
61-
val mainGeneration: NamedApiResource,
61+
val mainGeneration: NamedApiResource?,
6262
val names: List<Name>,
6363
val pokedexes: List<NamedApiResource>,
6464
val versionGroups: List<NamedApiResource>,

src/commonTest/kotlin/dev/sargunv/pokekotlin/test/BulkTest.kt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,22 @@ import kotlinx.coroutines.test.runTest
1010
@Ignore
1111
class BulkTest {
1212

13-
private suspend fun testCase(cat: String, ids: List<Int>, getObject: suspend (Int) -> Any) {
14-
var pass = true
15-
val count = ids.size
16-
println("$cat: $count total")
17-
ids.forEachIndexed { i, id ->
18-
println("$cat ${i + 1}/$count (id=$id)")
19-
try {
20-
getObject(id)
21-
} catch (e: Throwable) {
22-
println("ERROR: ${e::class.simpleName}: ${e.message}")
23-
pass = false
24-
}
13+
private suspend fun testCase(cat: String, id: Int, getObject: suspend (Int) -> Any) {
14+
println("$cat (id=$id)")
15+
try {
16+
getObject(id)
17+
} catch (e: Throwable) {
18+
println("ERROR: ${e::class.simpleName}: ${e.message}")
19+
fail()
2520
}
26-
if (!pass) fail()
2721
}
2822

2923
private suspend fun <T : ResourceSummary> testEach(
3024
getList: suspend (Int, Int) -> ResourceSummaryList<T>,
3125
getObject: suspend (Int) -> Any,
3226
) {
3327
val list = getList(0, getList(0, 0).count).results
34-
testCase(list[0].category, list.map { it.id }, getObject)
28+
list.forEach { testCase(list[0].category, it.id, getObject) }
3529
}
3630

3731
@Test

0 commit comments

Comments
 (0)