Add tests for RustMatrixClient.getDatabaseSizes()

This commit is contained in:
Jorge Martín
2025-12-17 09:01:35 +01:00
committed by Jorge Martin Espinosa
parent 9a9e84f6c8
commit de694cecdb
3 changed files with 39 additions and 0 deletions

View File

@@ -19,6 +19,23 @@ class ByteSize internal constructor(val value: Long, val unit: ByteUnit) {
if (unit == dest) return value
return value shl unit.bitShift shr dest.bitShift
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is ByteSize) return false
return value == other.value && unit == other.unit
}
override fun hashCode(): Int {
var result = value.hashCode()
result = 31 * result + unit.hashCode()
return result
}
override fun toString(): String {
return "$value $unit"
}
}
val Number.gigaBytes get() = ByteSize(toLong(), ByteUnit.GB)