mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-11 03:46:43 +01:00
BugFix for short lists
This commit is contained in:
@@ -75,6 +75,16 @@ class ExpandableViewComputationBenchmark {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun computeTestCase3All() {
|
||||||
|
benchmarkRule.measureRepeated {
|
||||||
|
TestCase.assertEquals(
|
||||||
|
65,
|
||||||
|
ExpandableTextParser.computeWhereToCutIfPostIsTooLong(testCase3),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val testCase1 = """
|
val testCase1 = """
|
||||||
#Amethyst v0.83.10
|
#Amethyst v0.83.10
|
||||||
|
|
||||||
@@ -137,4 +147,9 @@ Download:
|
|||||||
- [Play Edition](https://github.com/vitorpamplona/amethyst/releases/download/v0.83.10/amethyst-googleplay-universal-v0.83.10.apk )
|
- [Play Edition](https://github.com/vitorpamplona/amethyst/releases/download/v0.83.10/amethyst-googleplay-universal-v0.83.10.apk )
|
||||||
- [FOSS Edition - No translations](https://github.com/vitorpamplona/amethyst/releases/download/v0.83.10/amethyst-fdroid-universal-v0.83.10.apk )
|
- [FOSS Edition - No translations](https://github.com/vitorpamplona/amethyst/releases/download/v0.83.10/amethyst-fdroid-universal-v0.83.10.apk )
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
val testCase3 = """#100aDayUntil100k
|
||||||
|
Day 5 ✔️
|
||||||
|
|
||||||
|
Seems like they may be getting easier"""
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ fun String.nthIndexOf(
|
|||||||
while (occur > 0) {
|
while (occur > 0) {
|
||||||
// calling the native function multiple times is faster than looping just once
|
// calling the native function multiple times is faster than looping just once
|
||||||
pos = indexOf(ch, pos + 1)
|
pos = indexOf(ch, pos + 1)
|
||||||
|
if (pos == -1) return -1
|
||||||
occur--
|
occur--
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user