You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
481 B
28 lines
481 B
package net.pokeranalytics.android
|
|
|
|
import org.junit.Assert
|
|
import org.junit.Test
|
|
import timber.log.Timber
|
|
import java.text.NumberFormat
|
|
import java.text.ParseException
|
|
import java.util.*
|
|
|
|
class ParseTest {
|
|
|
|
@Test
|
|
fun test() {
|
|
|
|
val value = "2.0"
|
|
val formatter = NumberFormat.getInstance(Locale.US)
|
|
|
|
try {
|
|
val v = formatter.parse(value).toDouble()
|
|
Assert.assertEquals(2.0, v, 0.001)
|
|
} catch (e: ParseException) {
|
|
Timber.d("Unparseable number: $value")
|
|
}
|
|
|
|
}
|
|
|
|
|
|
} |