mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 00:10:32 +05:30
16 lines
542 B
Kotlin
16 lines
542 B
Kotlin
package com.github.libretube
|
|
|
|
import com.github.libretube.util.TextUtils.parseDurationString
|
|
import com.github.libretube.util.TextUtils.toTimeInSeconds
|
|
import org.junit.Test
|
|
import org.junit.Assert.assertEquals
|
|
|
|
class TextParserTest {
|
|
@Test
|
|
fun testTimeParser() {
|
|
assertEquals(15L * 60 + 20, "15m 20s".toTimeInSeconds())
|
|
assertEquals(1520L, "1520".toTimeInSeconds())
|
|
assertEquals(15L * 60 + 20, "15:20.25".toTimeInSeconds())
|
|
assertEquals(15f * 60 + 20 + 0.25f, "15:20.25".parseDurationString())
|
|
}
|
|
} |