diff options
author | Torsten Grote <t@grobox.de> | 2022-09-13 14:50:12 -0300 |
---|---|---|
committer | Torsten Grote <t@grobox.de> | 2022-09-13 14:50:12 -0300 |
commit | d03e2da37768cb3cdfe74774bc96d7b4d6c5acd7 (patch) | |
tree | 6273eaea6ad6f8e06d235069b37b91c7e2a67b96 | |
parent | ac64720eecda411934b75c75417f6d69a4a2f365 (diff) | |
download | taler-android-d03e2da37768cb3cdfe74774bc96d7b4d6c5acd7.tar.gz taler-android-d03e2da37768cb3cdfe74774bc96d7b4d6c5acd7.tar.bz2 taler-android-d03e2da37768cb3cdfe74774bc96d7b4d6c5acd7.zip |
[common] Add test for small bitcoin amounts
-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")) |