diff options
Diffstat (limited to 'taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt')
-rw-r--r-- | taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt b/taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt index 3343b52..7072426 100644 --- a/taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt +++ b/taler-kotlin-android/src/test/java/net/taler/common/AmountTest.kt @@ -16,11 +16,11 @@ package net.taler.common -import kotlin.random.Random import org.junit.Assert.assertEquals -import org.junit.Assert.assertTrue import org.junit.Assert.assertFalse +import org.junit.Assert.assertTrue import org.junit.Test +import kotlin.random.Random class AmountTest { @@ -61,6 +61,14 @@ class AmountTest { } @Test + fun testToString() { + Amount.fromString("BITCOINBTC", "0.00000001").let { amount -> + assertEquals("0.00000001 BITCOINBTC", amount.toString()) + assertEquals("0.00000001", amount.amountStr) + } + } + + @Test fun testFromJSONStringAcceptsMaxValuesRejectsAbove() { val maxValue = 4503599627370496 val str = "TESTKUDOS123:$maxValue.99999999" @@ -195,7 +203,7 @@ class AmountTest { } @Test - fun testComparision() { + fun testComparison() { assertTrue(Amount.fromJSONString("EUR:0") <= Amount.fromJSONString("EUR:0")) assertTrue(Amount.fromJSONString("EUR:0") <= Amount.fromJSONString("EUR:0.00000001")) assertTrue(Amount.fromJSONString("EUR:0") < Amount.fromJSONString("EUR:0.00000001")) |