Removing zatoshi tests entirely

This commit is contained in:
fekt
2023-04-09 21:34:10 -04:00
parent 9af5584247
commit 7c58b67795
2 changed files with 0 additions and 57 deletions

View File

@@ -8,10 +8,6 @@ package cash.z.ecc.android.sdk.model
* to avoid floating point imprecision.
*/
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 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.
*/
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
}
}

View File

@@ -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)
}
}
}