Removing zatoshi tests entirely
This commit is contained in:
@@ -8,10 +8,6 @@ package cash.z.ecc.android.sdk.model
|
|||||||
* to avoid floating point imprecision.
|
* to avoid floating point imprecision.
|
||||||
*/
|
*/
|
||||||
data class Zatoshi(val value: Long) : Comparable<Zatoshi> {
|
data class Zatoshi(val value: Long) : Comparable<Zatoshi> {
|
||||||
init {
|
|
||||||
require(value >= MIN_INCLUSIVE) { "Zatoshi must be in the range [$MIN_INCLUSIVE, $MAX_INCLUSIVE]" }
|
|
||||||
}
|
|
||||||
|
|
||||||
operator fun plus(other: Zatoshi) = Zatoshi(value + other.value)
|
operator fun plus(other: Zatoshi) = Zatoshi(value + other.value)
|
||||||
operator fun minus(other: Zatoshi) = Zatoshi(value - other.value)
|
operator fun minus(other: Zatoshi) = Zatoshi(value - other.value)
|
||||||
|
|
||||||
@@ -22,11 +18,5 @@ data class Zatoshi(val value: Long) : Comparable<Zatoshi> {
|
|||||||
* The number of Zatoshi that equal 1 ZEC.
|
* The number of Zatoshi that equal 1 ZEC.
|
||||||
*/
|
*/
|
||||||
const val ZATOSHI_PER_ZEC = 100_000_000L
|
const val ZATOSHI_PER_ZEC = 100_000_000L
|
||||||
|
|
||||||
private const val MAX_ZEC_SUPPLY = 21_000_000
|
|
||||||
|
|
||||||
const val MIN_INCLUSIVE = 0
|
|
||||||
|
|
||||||
const val MAX_INCLUSIVE = ZATOSHI_PER_ZEC * MAX_ZEC_SUPPLY
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
package cash.z.ecc.android.sdk.model
|
|
||||||
|
|
||||||
import org.junit.Test
|
|
||||||
import kotlin.test.assertEquals
|
|
||||||
import kotlin.test.assertFailsWith
|
|
||||||
import kotlin.test.assertTrue
|
|
||||||
|
|
||||||
class ZatoshiTest {
|
|
||||||
@Test
|
|
||||||
fun minValue() {
|
|
||||||
assertFailsWith<IllegalArgumentException> {
|
|
||||||
Zatoshi(Zatoshi.MIN_INCLUSIVE - 1L)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun plus() {
|
|
||||||
assertEquals(Zatoshi(4), Zatoshi(1) + Zatoshi(3))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun minus() {
|
|
||||||
assertEquals(Zatoshi(3), Zatoshi(4) - Zatoshi(1))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun compare_equal() {
|
|
||||||
assertEquals(0, Zatoshi(1).compareTo(Zatoshi(1)))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun compare_greater() {
|
|
||||||
assertTrue(Zatoshi(2) > Zatoshi(1))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun compare_less() {
|
|
||||||
assertTrue(Zatoshi(1) < Zatoshi(2))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
fun minus_fail() {
|
|
||||||
assertFailsWith<IllegalArgumentException> {
|
|
||||||
Zatoshi(5) - Zatoshi(6)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user