fix: Fix unit values

Signed-off-by: Myzel394 <50424412+Myzel394@users.noreply.github.com>
This commit is contained in:
Myzel394 2024-07-13 11:44:36 +02:00
parent 68c17d1d97
commit 0a021975fc
No known key found for this signature in database
GPG Key ID: DEC4AAB876F73185
2 changed files with 12 additions and 9 deletions

View File

@ -52,7 +52,7 @@ internal val areaCollection: List<BasicUnit> by lazy {
),
NormalUnit(
UnitID.square_foot,
BigDecimal("1396526843537100000000000000"),
BigDecimal("1396521251622100000000000000"),
UnitGroup.AREA,
R.string.unit_square_foot,
R.string.unit_square_foot_short,
@ -60,7 +60,7 @@ internal val areaCollection: List<BasicUnit> by lazy {
// https://www.gowebtool.com/unit-conversion/area/convert.php?from=electron_cross_section&to=square_mile_survey_us_statute
NormalUnit(
UnitID.square_mile,
BigDecimal("38932934238959000000000000000000000"),
BigDecimal("38932778061222000000000000000000000"),
UnitGroup.AREA,
R.string.unit_square_mile,
R.string.unit_square_mile_short,

View File

@ -120,16 +120,18 @@ class AllUnitsTest {
@Test
fun testArea() = testWithUnits {
cent.checkWith(acre, "75.9", "0.759")
cent.checkWith(square_meter, "1", "40.469")
cent.checkWith(square_meter, "1", "40.46856")
acre.checkWith(square_kilometer, "75.9", "0.30716")
acre.checkWith(square_yard, "1", "4840")
acre.checkWith(square_meter, "1", "4046.856")
acre.checkWith(cent, "1", "4046.856")
hectare.checkWith(acre, "1", "2.471");
hectare.checkWith(acre, "1", "2.471");
hectare.checkWith(square_foot, "75.9", "8169808.00585")
acre.checkWith(square_meter, "1", "4046.85642")
acre.checkWith(cent, "1", "100")
hectare.checkWith(acre, "1", "2.47105");
hectare.checkWith(square_foot, "1", "107639.10417")
hectare.checkWith(square_foot, "75.9", "8169808.00628")
square_foot.checkWith(square_decimeter, "75.9", "705.13407")
square_mile.checkWith(square_foot, "75.9", "2115970560.8762")
square_mile.checkWith(square_foot, "1", "27878400")
// Probably floating point error
square_mile.checkWith(square_foot, "75.9", "2115970560.00002")
square_yard.checkWith(square_foot, "75.9", "683.1")
square_yard.checkWith(square_foot, "1", "9")
square_inch.checkWith(square_foot, "75.9", "0.52708")
@ -140,6 +142,7 @@ class AllUnitsTest {
square_meter.checkWith(acre, "75.9", "0.01876")
square_kilometer.checkWith(hectare, "75.9", "7590")
electron_cross_section.checkWith(square_micrometer, "75.9", "0.000000000000005")
square_decimeter.checkWith(acre, "123.456", "0.00031")
}
@Test