Added helper method for unit conversion test

This commit is contained in:
Sad Ellie 2023-03-22 16:53:58 +03:00
parent 5b8d811ad6
commit c155f6c9c7

View File

@ -35,360 +35,360 @@ class AllUnitsTest {
private val allUnitsRepository = AllUnitsRepository() private val allUnitsRepository = AllUnitsRepository()
@Test @Test
fun testAcceleration() { fun testAcceleration() = testWithUnits {
MyUnitIDS.attometer_per_square_second.checkWith(MyUnitIDS.femtometer_per_square_second, "69", "0.069") attometer_per_square_second.checkWith(femtometer_per_square_second, "69", "0.069")
MyUnitIDS.femtometer_per_square_second.checkWith(MyUnitIDS.picometer_per_square_second, "69", "0.069") femtometer_per_square_second.checkWith(picometer_per_square_second, "69", "0.069")
MyUnitIDS.picometer_per_square_second.checkWith(MyUnitIDS.micrometer_per_square_second, "69", "0.00007") picometer_per_square_second.checkWith(micrometer_per_square_second, "69", "0.00007")
MyUnitIDS.nanometer_per_square_second.checkWith(MyUnitIDS.centimeter_per_square_second, "69", "0.000007") nanometer_per_square_second.checkWith(centimeter_per_square_second, "69", "0.000007")
MyUnitIDS.micrometer_per_square_second.checkWith(MyUnitIDS.nanometer_per_square_second, "69", "69000") micrometer_per_square_second.checkWith(nanometer_per_square_second, "69", "69000")
MyUnitIDS.millimeter_per_square_second.checkWith(MyUnitIDS.centimeter_per_square_second, "69", "6.9") millimeter_per_square_second.checkWith(centimeter_per_square_second, "69", "6.9")
MyUnitIDS.centimeter_per_square_second.checkWith(MyUnitIDS.meter_per_square_second, "69", "0.69") centimeter_per_square_second.checkWith(meter_per_square_second, "69", "0.69")
MyUnitIDS.decimeter_per_square_second.checkWith(MyUnitIDS.meter_per_square_second, "69", "6.9") decimeter_per_square_second.checkWith(meter_per_square_second, "69", "6.9")
MyUnitIDS.meter_per_square_second.checkWith(MyUnitIDS.micrometer_per_square_second, "69", "69000000") meter_per_square_second.checkWith(micrometer_per_square_second, "69", "69000000")
MyUnitIDS.kilometer_per_square_second.checkWith(MyUnitIDS.hectometer_per_square_second, "69", "690") kilometer_per_square_second.checkWith(hectometer_per_square_second, "69", "690")
MyUnitIDS.dekameter_per_square_second.checkWith(MyUnitIDS.gal, "69", "69000") dekameter_per_square_second.checkWith(gal, "69", "69000")
MyUnitIDS.hectometer_per_square_second.checkWith(MyUnitIDS.gal, "69", "690000") hectometer_per_square_second.checkWith(gal, "69", "690000")
MyUnitIDS.gal.checkWith(MyUnitIDS.centimeter_per_square_second, "69", "69") gal.checkWith(centimeter_per_square_second, "69", "69")
MyUnitIDS.mercury_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "3.7") mercury_surface_gravity.checkWith(meter_per_square_second, "1", "3.7")
MyUnitIDS.venus_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "8.87") venus_surface_gravity.checkWith(meter_per_square_second, "1", "8.87")
MyUnitIDS.earth_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "9.80655") earth_surface_gravity.checkWith(meter_per_square_second, "1", "9.80655")
MyUnitIDS.mars_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "3.71") mars_surface_gravity.checkWith(meter_per_square_second, "1", "3.71")
MyUnitIDS.jupiter_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "24.79") jupiter_surface_gravity.checkWith(meter_per_square_second, "1", "24.79")
MyUnitIDS.saturn_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "10.44") saturn_surface_gravity.checkWith(meter_per_square_second, "1", "10.44")
MyUnitIDS.uranus_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "8.87") uranus_surface_gravity.checkWith(meter_per_square_second, "1", "8.87")
MyUnitIDS.neptune_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "11.15") neptune_surface_gravity.checkWith(meter_per_square_second, "1", "11.15")
MyUnitIDS.sun_surface_gravity.checkWith(MyUnitIDS.meter_per_square_second, "1", "274") sun_surface_gravity.checkWith(meter_per_square_second, "1", "274")
} }
@Test @Test
fun testAngle() { fun testAngle() = testWithUnits {
MyUnitIDS.angle_second.checkWith(MyUnitIDS.angle_minute, "420.5", "7.00833") angle_second.checkWith(angle_minute, "420.5", "7.00833")
MyUnitIDS.angle_minute.checkWith(MyUnitIDS.radian, "420.5", "0.12232") angle_minute.checkWith(radian, "420.5", "0.12232")
MyUnitIDS.degree.checkWith(MyUnitIDS.turn, "420.5", "1.16806") degree.checkWith(turn, "420.5", "1.16806")
MyUnitIDS.radian.checkWith(MyUnitIDS.turn, "420.5", "66.92465") radian.checkWith(turn, "420.5", "66.92465")
MyUnitIDS.sextant.checkWith(MyUnitIDS.radian, "420.5", "440.34657") sextant.checkWith(radian, "420.5", "440.34657")
MyUnitIDS.turn.checkWith(MyUnitIDS.angle_minute, "420.5", "9082800") turn.checkWith(angle_minute, "420.5", "9082800")
} }
@Test @Test
fun testArea() { fun testArea() = testWithUnits {
MyUnitIDS.cent.checkWith(MyUnitIDS.acre, "75.9", "7590") cent.checkWith(acre, "75.9", "7590")
MyUnitIDS.acre.checkWith(MyUnitIDS.square_kilometer, "75.9", "0.30716") acre.checkWith(square_kilometer, "75.9", "0.30716")
MyUnitIDS.hectare.checkWith(MyUnitIDS.square_foot, "75.9", "8169808.00585") hectare.checkWith(square_foot, "75.9", "8169808.00585")
MyUnitIDS.square_foot.checkWith(MyUnitIDS.square_decimeter, "75.9", "705.13407") square_foot.checkWith(square_decimeter, "75.9", "705.13407")
MyUnitIDS.square_mile.checkWith(MyUnitIDS.square_foot, "75.9", "2115970560.8762") square_mile.checkWith(square_foot, "75.9", "2115970560.8762")
MyUnitIDS.square_yard.checkWith(MyUnitIDS.square_foot, "75.9", "683.1") square_yard.checkWith(square_foot, "75.9", "683.1")
MyUnitIDS.square_inch.checkWith(MyUnitIDS.square_foot, "75.9", "0.52708") square_inch.checkWith(square_foot, "75.9", "0.52708")
MyUnitIDS.square_micrometer.checkWith(MyUnitIDS.square_millimeter, "75.9", "0.00008") square_micrometer.checkWith(square_millimeter, "75.9", "0.00008")
MyUnitIDS.square_millimeter.checkWith(MyUnitIDS.square_centimeter, "75.9", "0.759") square_millimeter.checkWith(square_centimeter, "75.9", "0.759")
MyUnitIDS.square_centimeter.checkWith(MyUnitIDS.acre, "75.9", "0.000002") square_centimeter.checkWith(acre, "75.9", "0.000002")
MyUnitIDS.square_decimeter.checkWith(MyUnitIDS.square_meter, "75.9", "0.759") square_decimeter.checkWith(square_meter, "75.9", "0.759")
MyUnitIDS.square_meter.checkWith(MyUnitIDS.acre, "75.9", "0.01876") square_meter.checkWith(acre, "75.9", "0.01876")
MyUnitIDS.square_kilometer.checkWith(MyUnitIDS.hectare, "75.9", "7590") square_kilometer.checkWith(hectare, "75.9", "7590")
MyUnitIDS.electron_cross_section.checkWith(MyUnitIDS.square_micrometer, "75.9", "0.000000000000005") electron_cross_section.checkWith(square_micrometer, "75.9", "0.000000000000005")
} }
@Test @Test
fun testDataTransfer() { fun testDataTransfer() = testWithUnits {
MyUnitIDS.bit_per_second.checkWith(MyUnitIDS.kilobit_per_second, "2048", "2.048") bit_per_second.checkWith(kilobit_per_second, "2048", "2.048")
MyUnitIDS.kibibit_per_second.checkWith(MyUnitIDS.bit_per_second, "2048", "2097152") kibibit_per_second.checkWith(bit_per_second, "2048", "2097152")
MyUnitIDS.kilobit_per_second.checkWith(MyUnitIDS.bit_per_second, "2048", "2048000") kilobit_per_second.checkWith(bit_per_second, "2048", "2048000")
MyUnitIDS.megabit_per_second.checkWith(MyUnitIDS.kilobit_per_second, "2048", "2048000") megabit_per_second.checkWith(kilobit_per_second, "2048", "2048000")
MyUnitIDS.mebibit_per_second.checkWith(MyUnitIDS.kilobit_per_second, "2048", "2147483.648") mebibit_per_second.checkWith(kilobit_per_second, "2048", "2147483.648")
MyUnitIDS.gigabit_per_second.checkWith(MyUnitIDS.kilobit_per_second, "2048", "2048000000") gigabit_per_second.checkWith(kilobit_per_second, "2048", "2048000000")
MyUnitIDS.terabit_per_second.checkWith(MyUnitIDS.gigabyte_per_second, "2048", "256000") terabit_per_second.checkWith(gigabyte_per_second, "2048", "256000")
MyUnitIDS.petabit_per_second.checkWith(MyUnitIDS.gigabyte_per_second, "2048", "256000000") petabit_per_second.checkWith(gigabyte_per_second, "2048", "256000000")
MyUnitIDS.exabit_per_second.checkWith(MyUnitIDS.petabit_per_second, "2048", "2048000") exabit_per_second.checkWith(petabit_per_second, "2048", "2048000")
MyUnitIDS.byte_per_second.checkWith(MyUnitIDS.bit_per_second, "2048", "16384") byte_per_second.checkWith(bit_per_second, "2048", "16384")
MyUnitIDS.kibibyte_per_second.checkWith(MyUnitIDS.bit_per_second, "2048", "16777216") kibibyte_per_second.checkWith(bit_per_second, "2048", "16777216")
MyUnitIDS.kilobyte_per_second.checkWith(MyUnitIDS.kibibit_per_second, "2048", "16000") kilobyte_per_second.checkWith(kibibit_per_second, "2048", "16000")
MyUnitIDS.megabyte_per_second.checkWith(MyUnitIDS.kilobyte_per_second, "2048", "2048000") megabyte_per_second.checkWith(kilobyte_per_second, "2048", "2048000")
MyUnitIDS.mebibyte_per_second.checkWith(MyUnitIDS.bit_per_second, "2048", "17179869184") mebibyte_per_second.checkWith(bit_per_second, "2048", "17179869184")
MyUnitIDS.gigabyte_per_second.checkWith(MyUnitIDS.kilobyte_per_second, "2048", "2048000000") gigabyte_per_second.checkWith(kilobyte_per_second, "2048", "2048000000")
MyUnitIDS.terabyte_per_second.checkWith(MyUnitIDS.gigabyte_per_second, "2048", "2048000") terabyte_per_second.checkWith(gigabyte_per_second, "2048", "2048000")
MyUnitIDS.petabyte_per_second.checkWith(MyUnitIDS.terabyte_per_second, "2048", "2048000") petabyte_per_second.checkWith(terabyte_per_second, "2048", "2048000")
MyUnitIDS.exabyte_per_second.checkWith(MyUnitIDS.petabyte_per_second, "2048", "2048000") exabyte_per_second.checkWith(petabyte_per_second, "2048", "2048000")
} }
@Test @Test
fun testEnergy() { fun testEnergy() = testWithUnits {
MyUnitIDS.electron_volt.checkWith(MyUnitIDS.joule, "56000000000000000000", "8.97219") electron_volt.checkWith(joule, "56000000000000000000", "8.97219")
MyUnitIDS.attojoule.checkWith(MyUnitIDS.calorie_th, "41840000000000", "0.00001") attojoule.checkWith(calorie_th, "41840000000000", "0.00001")
MyUnitIDS.joule.checkWith(MyUnitIDS.kilocalorie_th, "4184", "1") joule.checkWith(kilocalorie_th, "4184", "1")
MyUnitIDS.kilojoule.checkWith(MyUnitIDS.calorie_th, "4184000000", "1000000000000") kilojoule.checkWith(calorie_th, "4184000000", "1000000000000")
MyUnitIDS.megajoule.checkWith(MyUnitIDS.calorie_th, "0.4184", "100000") megajoule.checkWith(calorie_th, "0.4184", "100000")
MyUnitIDS.gigajoule.checkWith(MyUnitIDS.calorie_th, "0.4184", "100000000") gigajoule.checkWith(calorie_th, "0.4184", "100000000")
MyUnitIDS.energy_ton.checkWith(MyUnitIDS.calorie_th, "0.4184", "418400000") energy_ton.checkWith(calorie_th, "0.4184", "418400000")
MyUnitIDS.kiloton.checkWith(MyUnitIDS.calorie_th, "0.4184", "418400000000") kiloton.checkWith(calorie_th, "0.4184", "418400000000")
MyUnitIDS.megaton.checkWith(MyUnitIDS.calorie_th, "0.4184", "418400000000000") megaton.checkWith(calorie_th, "0.4184", "418400000000000")
MyUnitIDS.gigaton.checkWith(MyUnitIDS.calorie_th, "0.000000004184", "4184000000") gigaton.checkWith(calorie_th, "0.000000004184", "4184000000")
MyUnitIDS.energy_horse_power_metric.checkWith(MyUnitIDS.joule, "10", "26477955") energy_horse_power_metric.checkWith(joule, "10", "26477955")
MyUnitIDS.calorie_th.checkWith(MyUnitIDS.joule, "10", "41.84") calorie_th.checkWith(joule, "10", "41.84")
MyUnitIDS.kilocalorie_th.checkWith(MyUnitIDS.joule, "10", "41840") kilocalorie_th.checkWith(joule, "10", "41840")
} }
@Test @Test
fun testFileSize() { fun testFileSize() = testWithUnits {
MyUnitIDS.bit.checkWith(MyUnitIDS.kilobit, "2048", "2.048") bit.checkWith(kilobit, "2048", "2.048")
MyUnitIDS.kibibit.checkWith(MyUnitIDS.bit, "2048", "2097152") kibibit.checkWith(bit, "2048", "2097152")
MyUnitIDS.kilobit.checkWith(MyUnitIDS.bit, "2048", "2048000") kilobit.checkWith(bit, "2048", "2048000")
MyUnitIDS.megabit.checkWith(MyUnitIDS.kilobit, "2048", "2048000") megabit.checkWith(kilobit, "2048", "2048000")
MyUnitIDS.mebibit.checkWith(MyUnitIDS.kilobit, "2048", "2147483.648") mebibit.checkWith(kilobit, "2048", "2147483.648")
MyUnitIDS.gigabit.checkWith(MyUnitIDS.kilobit, "2048", "2048000000") gigabit.checkWith(kilobit, "2048", "2048000000")
MyUnitIDS.terabit.checkWith(MyUnitIDS.gigabyte, "2048", "256000") terabit.checkWith(gigabyte, "2048", "256000")
MyUnitIDS.petabit.checkWith(MyUnitIDS.gigabyte, "2048", "256000000") petabit.checkWith(gigabyte, "2048", "256000000")
MyUnitIDS.exabit.checkWith(MyUnitIDS.petabit, "2048", "2048000") exabit.checkWith(petabit, "2048", "2048000")
MyUnitIDS.byte.checkWith(MyUnitIDS.bit, "2048", "16384") byte.checkWith(bit, "2048", "16384")
MyUnitIDS.kibibyte.checkWith(MyUnitIDS.bit, "2048", "16777216") kibibyte.checkWith(bit, "2048", "16777216")
MyUnitIDS.kilobyte.checkWith(MyUnitIDS.kibibit, "2048", "16000") kilobyte.checkWith(kibibit, "2048", "16000")
MyUnitIDS.megabyte.checkWith(MyUnitIDS.kilobyte, "2048", "2048000") megabyte.checkWith(kilobyte, "2048", "2048000")
MyUnitIDS.mebibyte.checkWith(MyUnitIDS.bit, "2048", "17179869184") mebibyte.checkWith(bit, "2048", "17179869184")
MyUnitIDS.gigabyte.checkWith(MyUnitIDS.kilobyte, "2048", "2048000000") gigabyte.checkWith(kilobyte, "2048", "2048000000")
MyUnitIDS.terabyte.checkWith(MyUnitIDS.gigabyte, "2048", "2048000") terabyte.checkWith(gigabyte, "2048", "2048000")
MyUnitIDS.petabyte.checkWith(MyUnitIDS.terabyte, "2048", "2048000") petabyte.checkWith(terabyte, "2048", "2048000")
MyUnitIDS.exabyte.checkWith(MyUnitIDS.petabyte, "2048", "2048000") exabyte.checkWith(petabyte, "2048", "2048000")
} }
@Test @Test
fun testLength() { fun testLength() = testWithUnits {
MyUnitIDS.attometer.checkWith(MyUnitIDS.micrometer, "158000000000.7", "0.158") attometer.checkWith(micrometer, "158000000000.7", "0.158")
MyUnitIDS.nanometer.checkWith(MyUnitIDS.inch, "158000000000.7", "6220.47244") nanometer.checkWith(inch, "158000000000.7", "6220.47244")
MyUnitIDS.micrometer.checkWith(MyUnitIDS.inch, "158000000000.7", "6220472.44097") micrometer.checkWith(inch, "158000000000.7", "6220472.44097")
MyUnitIDS.millimeter.checkWith(MyUnitIDS.inch, "158000.7", "6220.5") millimeter.checkWith(inch, "158000.7", "6220.5")
MyUnitIDS.centimeter.checkWith(MyUnitIDS.inch, "158000.7", "62205") centimeter.checkWith(inch, "158000.7", "62205")
MyUnitIDS.decimeter.checkWith(MyUnitIDS.foot, "158000.7", "51837.5") decimeter.checkWith(foot, "158000.7", "51837.5")
MyUnitIDS.meter.checkWith(MyUnitIDS.yard, "158000.7", "172791.66667") meter.checkWith(yard, "158000.7", "172791.66667")
MyUnitIDS.kilometer.checkWith(MyUnitIDS.mile, "100", "62.13712") kilometer.checkWith(mile, "100", "62.13712")
MyUnitIDS.nautical_mile.checkWith(MyUnitIDS.kilometer, "100", "185.2") nautical_mile.checkWith(kilometer, "100", "185.2")
MyUnitIDS.inch.checkWith(MyUnitIDS.foot, "100", "8.33333") inch.checkWith(foot, "100", "8.33333")
MyUnitIDS.foot.checkWith(MyUnitIDS.inch, "100", "1200") foot.checkWith(inch, "100", "1200")
MyUnitIDS.yard.checkWith(MyUnitIDS.foot, "100", "300") yard.checkWith(foot, "100", "300")
MyUnitIDS.mile.checkWith(MyUnitIDS.foot, "100", "528000") mile.checkWith(foot, "100", "528000")
MyUnitIDS.light_year.checkWith(MyUnitIDS.foot, "0.0000001", "3103914196.85037") light_year.checkWith(foot, "0.0000001", "3103914196.85037")
MyUnitIDS.parsec.checkWith(MyUnitIDS.foot, "0.00000001", "1012361411.25044") parsec.checkWith(foot, "0.00000001", "1012361411.25044")
MyUnitIDS.kiloparsec.checkWith(MyUnitIDS.foot, "0.00000000001", "1012361411.25044") kiloparsec.checkWith(foot, "0.00000000001", "1012361411.25044")
MyUnitIDS.megaparsec.checkWith(MyUnitIDS.foot, "0.00000000000001", "1012361411.25044") megaparsec.checkWith(foot, "0.00000000000001", "1012361411.25044")
MyUnitIDS.mercury_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "2439.7") mercury_equatorial_radius.checkWith(kilometer, "1", "2439.7")
MyUnitIDS.venus_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "6051.8") venus_equatorial_radius.checkWith(kilometer, "1", "6051.8")
MyUnitIDS.earth_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "6371") earth_equatorial_radius.checkWith(kilometer, "1", "6371")
MyUnitIDS.mars_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "3389.5") mars_equatorial_radius.checkWith(kilometer, "1", "3389.5")
MyUnitIDS.jupiter_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "69911") jupiter_equatorial_radius.checkWith(kilometer, "1", "69911")
MyUnitIDS.saturn_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "58232") saturn_equatorial_radius.checkWith(kilometer, "1", "58232")
MyUnitIDS.uranus_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "25362") uranus_equatorial_radius.checkWith(kilometer, "1", "25362")
MyUnitIDS.neptune_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "24622") neptune_equatorial_radius.checkWith(kilometer, "1", "24622")
MyUnitIDS.sun_equatorial_radius.checkWith(MyUnitIDS.kilometer, "1", "695508") sun_equatorial_radius.checkWith(kilometer, "1", "695508")
} }
@Test @Test
fun testMass() { fun testMass() = testWithUnits {
MyUnitIDS.electron_mass_rest.checkWith(MyUnitIDS.milligram, "1500000000000000000", "0.000001") electron_mass_rest.checkWith(milligram, "1500000000000000000", "0.000001")
MyUnitIDS.atomic_mass_unit.checkWith(MyUnitIDS.electron_mass_rest, "150", "273433.27951") atomic_mass_unit.checkWith(electron_mass_rest, "150", "273433.27951")
MyUnitIDS.milligram.checkWith(MyUnitIDS.ounce, "1500", "0.05291") milligram.checkWith(ounce, "1500", "0.05291")
MyUnitIDS.gram.checkWith(MyUnitIDS.ounce, "1500", "52.91094") gram.checkWith(ounce, "1500", "52.91094")
MyUnitIDS.kilogram.checkWith(MyUnitIDS.carat, "1500", "7500000") kilogram.checkWith(carat, "1500", "7500000")
MyUnitIDS.metric_ton.checkWith(MyUnitIDS.carat, "1500", "7500000000") metric_ton.checkWith(carat, "1500", "7500000000")
MyUnitIDS.imperial_ton.checkWith(MyUnitIDS.kilogram, "1500", "1524070.3632") imperial_ton.checkWith(kilogram, "1500", "1524070.3632")
MyUnitIDS.ounce.checkWith(MyUnitIDS.pound, "1500", "93.75") ounce.checkWith(pound, "1500", "93.75")
MyUnitIDS.carat.checkWith(MyUnitIDS.pound, "1500", "0.66139") carat.checkWith(pound, "1500", "0.66139")
MyUnitIDS.pound.checkWith(MyUnitIDS.kilogram, "1500", "680.38856") pound.checkWith(kilogram, "1500", "680.38856")
MyUnitIDS.mercury_mass.checkWith(MyUnitIDS.kilogram, "1", "330104000000000000000000") mercury_mass.checkWith(kilogram, "1", "330104000000000000000000")
MyUnitIDS.venus_mass.checkWith(MyUnitIDS.kilogram, "1", "4867320000000000000000000") venus_mass.checkWith(kilogram, "1", "4867320000000000000000000")
MyUnitIDS.earth_mass.checkWith(MyUnitIDS.kilogram, "1", "5972190000000000000000000") earth_mass.checkWith(kilogram, "1", "5972190000000000000000000")
MyUnitIDS.mars_mass.checkWith(MyUnitIDS.kilogram, "1", "641693000000000000000000") mars_mass.checkWith(kilogram, "1", "641693000000000000000000")
MyUnitIDS.jupiter_mass.checkWith(MyUnitIDS.kilogram, "1", "1898130000000000000000000000") jupiter_mass.checkWith(kilogram, "1", "1898130000000000000000000000")
MyUnitIDS.saturn_mass.checkWith(MyUnitIDS.kilogram, "1", "568319000000000000000000000") saturn_mass.checkWith(kilogram, "1", "568319000000000000000000000")
MyUnitIDS.uranus_mass.checkWith(MyUnitIDS.kilogram, "1", "86810300000000000000000000") uranus_mass.checkWith(kilogram, "1", "86810300000000000000000000")
MyUnitIDS.neptune_mass.checkWith(MyUnitIDS.kilogram, "1", "102410000000000000000000000") neptune_mass.checkWith(kilogram, "1", "102410000000000000000000000")
MyUnitIDS.sun_mass.checkWith(MyUnitIDS.kilogram, "1", "1989100000000000000000000000000") sun_mass.checkWith(kilogram, "1", "1989100000000000000000000000000")
} }
@Test @Test
fun testPower() { fun testPower() = testWithUnits {
MyUnitIDS.attowatt.checkWith(MyUnitIDS.watt, "3950000000000000", "0.00395") attowatt.checkWith(watt, "3950000000000000", "0.00395")
MyUnitIDS.watt.checkWith(MyUnitIDS.kilowatt, "395", "0.395") watt.checkWith(kilowatt, "395", "0.395")
MyUnitIDS.kilowatt.checkWith(MyUnitIDS.horse_power_mechanical, "395", "529.70373") kilowatt.checkWith(horse_power_mechanical, "395", "529.70373")
MyUnitIDS.megawatt.checkWith(MyUnitIDS.horse_power_mechanical, "395", "529703.72539") megawatt.checkWith(horse_power_mechanical, "395", "529703.72539")
MyUnitIDS.horse_power_mechanical.checkWith(MyUnitIDS.kilowatt, "395", "294.55145") horse_power_mechanical.checkWith(kilowatt, "395", "294.55145")
} }
@Test @Test
fun testPressure() { fun testPressure() = testWithUnits {
MyUnitIDS.attopascal.checkWith(MyUnitIDS.femtopascal, "456", "0.456") attopascal.checkWith(femtopascal, "456", "0.456")
MyUnitIDS.femtopascal.checkWith(MyUnitIDS.picopascal, "456", "0.456") femtopascal.checkWith(picopascal, "456", "0.456")
MyUnitIDS.picopascal.checkWith(MyUnitIDS.nanopascal, "456", "0.456") picopascal.checkWith(nanopascal, "456", "0.456")
MyUnitIDS.nanopascal.checkWith(MyUnitIDS.micropascal, "456", "0.456") nanopascal.checkWith(micropascal, "456", "0.456")
MyUnitIDS.micropascal.checkWith(MyUnitIDS.millipascal, "456", "0.456") micropascal.checkWith(millipascal, "456", "0.456")
MyUnitIDS.millipascal.checkWith(MyUnitIDS.centipascal, "456", "45.6") millipascal.checkWith(centipascal, "456", "45.6")
MyUnitIDS.centipascal.checkWith(MyUnitIDS.decipascal, "456", "45.6") centipascal.checkWith(decipascal, "456", "45.6")
MyUnitIDS.decipascal.checkWith(MyUnitIDS.dekapascal, "456", "4.56") decipascal.checkWith(dekapascal, "456", "4.56")
MyUnitIDS.pascal.checkWith(MyUnitIDS.bar, "456", "0.00456") pascal.checkWith(bar, "456", "0.00456")
MyUnitIDS.dekapascal.checkWith(MyUnitIDS.bar, "456", "0.0456") dekapascal.checkWith(bar, "456", "0.0456")
MyUnitIDS.hectopascal.checkWith(MyUnitIDS.psi, "456", "6.61372") hectopascal.checkWith(psi, "456", "6.61372")
MyUnitIDS.millibar.checkWith(MyUnitIDS.psi, "456", "6.61372") millibar.checkWith(psi, "456", "6.61372")
MyUnitIDS.bar.checkWith(MyUnitIDS.ksi, "456", "6.61372") bar.checkWith(ksi, "456", "6.61372")
MyUnitIDS.kilopascal.checkWith(MyUnitIDS.psi, "456", "66.13721") kilopascal.checkWith(psi, "456", "66.13721")
MyUnitIDS.megapascal.checkWith(MyUnitIDS.ksi, "456", "66.13721") megapascal.checkWith(ksi, "456", "66.13721")
MyUnitIDS.gigapascal.checkWith(MyUnitIDS.torr, "456", "3420281273.13024") gigapascal.checkWith(torr, "456", "3420281273.13024")
MyUnitIDS.terapascal.checkWith(MyUnitIDS.gigapascal, "456", "456000") terapascal.checkWith(gigapascal, "456", "456000")
MyUnitIDS.petapascal.checkWith(MyUnitIDS.gigapascal, "456", "456000000") petapascal.checkWith(gigapascal, "456", "456000000")
MyUnitIDS.exapascal.checkWith(MyUnitIDS.gigapascal, "456", "456000000000") exapascal.checkWith(gigapascal, "456", "456000000000")
MyUnitIDS.psi.checkWith(MyUnitIDS.gigapascal, "456", "0.00314") psi.checkWith(gigapascal, "456", "0.00314")
MyUnitIDS.ksi.checkWith(MyUnitIDS.gigapascal, "456", "3.14401") ksi.checkWith(gigapascal, "456", "3.14401")
MyUnitIDS.standard_atmosphere.checkWith(MyUnitIDS.torr, "456", "346560") standard_atmosphere.checkWith(torr, "456", "346560")
MyUnitIDS.torr.checkWith(MyUnitIDS.hectopascal, "456", "607.95") torr.checkWith(hectopascal, "456", "607.95")
MyUnitIDS.micron_of_mercury.checkWith(MyUnitIDS.hectopascal, "456", "0.60795") micron_of_mercury.checkWith(hectopascal, "456", "0.60795")
MyUnitIDS.millimeter_of_mercury.checkWith(MyUnitIDS.hectopascal, "456", "607.95") millimeter_of_mercury.checkWith(hectopascal, "456", "607.95")
} }
@Test @Test
fun testSpeed() { fun testSpeed() = testWithUnits {
MyUnitIDS.millimeter_per_hour.checkWith(MyUnitIDS.kilometer_per_hour, "396", "0.0004") millimeter_per_hour.checkWith(kilometer_per_hour, "396", "0.0004")
MyUnitIDS.millimeter_per_minute.checkWith(MyUnitIDS.kilometer_per_hour, "396", "0.02376") millimeter_per_minute.checkWith(kilometer_per_hour, "396", "0.02376")
MyUnitIDS.millimeter_per_second.checkWith(MyUnitIDS.kilometer_per_hour, "396", "1.4256") millimeter_per_second.checkWith(kilometer_per_hour, "396", "1.4256")
MyUnitIDS.centimeter_per_hour.checkWith(MyUnitIDS.kilometer_per_hour, "396", "0.00396") centimeter_per_hour.checkWith(kilometer_per_hour, "396", "0.00396")
MyUnitIDS.centimeter_per_minute.checkWith(MyUnitIDS.kilometer_per_hour, "396", "0.2376") centimeter_per_minute.checkWith(kilometer_per_hour, "396", "0.2376")
MyUnitIDS.centimeter_per_second.checkWith(MyUnitIDS.kilometer_per_hour, "396", "14.256") centimeter_per_second.checkWith(kilometer_per_hour, "396", "14.256")
MyUnitIDS.meter_per_hour.checkWith(MyUnitIDS.kilometer_per_hour, "396", "0.396") meter_per_hour.checkWith(kilometer_per_hour, "396", "0.396")
MyUnitIDS.meter_per_minute.checkWith(MyUnitIDS.kilometer_per_hour, "396", "23.76") meter_per_minute.checkWith(kilometer_per_hour, "396", "23.76")
MyUnitIDS.meter_per_second.checkWith(MyUnitIDS.kilometer_per_hour, "396", "1425.6") meter_per_second.checkWith(kilometer_per_hour, "396", "1425.6")
MyUnitIDS.kilometer_per_hour.checkWith(MyUnitIDS.mile_per_hour, "396", "246.06299") kilometer_per_hour.checkWith(mile_per_hour, "396", "246.06299")
MyUnitIDS.kilometer_per_minute.checkWith(MyUnitIDS.mile_per_hour, "396", "14763.77953") kilometer_per_minute.checkWith(mile_per_hour, "396", "14763.77953")
MyUnitIDS.kilometer_per_second.checkWith(MyUnitIDS.mile_per_hour, "396", "885826.77165") kilometer_per_second.checkWith(mile_per_hour, "396", "885826.77165")
MyUnitIDS.foot_per_hour.checkWith(MyUnitIDS.mile_per_hour, "396", "0.075") foot_per_hour.checkWith(mile_per_hour, "396", "0.075")
MyUnitIDS.foot_per_minute.checkWith(MyUnitIDS.mile_per_hour, "396", "4.5") foot_per_minute.checkWith(mile_per_hour, "396", "4.5")
MyUnitIDS.foot_per_second.checkWith(MyUnitIDS.mile_per_hour, "396", "270") foot_per_second.checkWith(mile_per_hour, "396", "270")
MyUnitIDS.yard_per_hour.checkWith(MyUnitIDS.mile_per_hour, "396", "0.225") yard_per_hour.checkWith(mile_per_hour, "396", "0.225")
MyUnitIDS.yard_per_minute.checkWith(MyUnitIDS.mile_per_hour, "396", "13.5") yard_per_minute.checkWith(mile_per_hour, "396", "13.5")
MyUnitIDS.yard_per_second.checkWith(MyUnitIDS.mile_per_hour, "396", "810") yard_per_second.checkWith(mile_per_hour, "396", "810")
MyUnitIDS.mile_per_hour.checkWith(MyUnitIDS.foot_per_hour, "396", "2090880") mile_per_hour.checkWith(foot_per_hour, "396", "2090880")
MyUnitIDS.mile_per_minute.checkWith(MyUnitIDS.foot_per_hour, "396", "125452800") mile_per_minute.checkWith(foot_per_hour, "396", "125452800")
MyUnitIDS.mile_per_second.checkWith(MyUnitIDS.foot_per_hour, "396", "7527168000") mile_per_second.checkWith(foot_per_hour, "396", "7527168000")
MyUnitIDS.knot.checkWith(MyUnitIDS.meter_per_hour, "396", "733392") knot.checkWith(meter_per_hour, "396", "733392")
MyUnitIDS.velocity_of_light_in_vacuum.checkWith(MyUnitIDS.meter_per_second, "1", "299792458") velocity_of_light_in_vacuum.checkWith(meter_per_second, "1", "299792458")
MyUnitIDS.cosmic_velocity_first.checkWith(MyUnitIDS.meter_per_second, "1", "7900") cosmic_velocity_first.checkWith(meter_per_second, "1", "7900")
MyUnitIDS.cosmic_velocity_second.checkWith(MyUnitIDS.meter_per_second, "1", "11200") cosmic_velocity_second.checkWith(meter_per_second, "1", "11200")
MyUnitIDS.cosmic_velocity_third.checkWith(MyUnitIDS.meter_per_second, "1", "16670") cosmic_velocity_third.checkWith(meter_per_second, "1", "16670")
MyUnitIDS.earths_orbital_speed.checkWith(MyUnitIDS.meter_per_second, "1", "29765") earths_orbital_speed.checkWith(meter_per_second, "1", "29765")
MyUnitIDS.mach.checkWith(MyUnitIDS.meter_per_second, "1", "343.6") mach.checkWith(meter_per_second, "1", "343.6")
MyUnitIDS.mach_si_standard.checkWith(MyUnitIDS.meter_per_second, "1", "295.0464") mach_si_standard.checkWith(meter_per_second, "1", "295.0464")
} }
@Test @Test
fun testTemperature() { fun testTemperature() = testWithUnits {
MyUnitIDS.celsius.checkWith(MyUnitIDS.celsius, "0", "0") celsius.checkWith(celsius, "0", "0")
MyUnitIDS.celsius.checkWith(MyUnitIDS.fahrenheit, "0", "32") celsius.checkWith(fahrenheit, "0", "32")
MyUnitIDS.celsius.checkWith(MyUnitIDS.kelvin, "0", "273.15") celsius.checkWith(kelvin, "0", "273.15")
MyUnitIDS.celsius.checkWith(MyUnitIDS.celsius, "36.6", "36.6") celsius.checkWith(celsius, "36.6", "36.6")
MyUnitIDS.celsius.checkWith(MyUnitIDS.fahrenheit, "36.6", "97.88") celsius.checkWith(fahrenheit, "36.6", "97.88")
MyUnitIDS.celsius.checkWith(MyUnitIDS.kelvin, "36.6", "309.75") celsius.checkWith(kelvin, "36.6", "309.75")
MyUnitIDS.celsius.checkWith(MyUnitIDS.celsius, "-36.6", "-36.6") celsius.checkWith(celsius, "-36.6", "-36.6")
MyUnitIDS.celsius.checkWith(MyUnitIDS.fahrenheit, "-36.6", "-33.88") celsius.checkWith(fahrenheit, "-36.6", "-33.88")
MyUnitIDS.celsius.checkWith(MyUnitIDS.kelvin, "-36.6", "236.55") celsius.checkWith(kelvin, "-36.6", "236.55")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.celsius, "0", "-17.77778") fahrenheit.checkWith(celsius, "0", "-17.77778")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.fahrenheit, "0", "0") fahrenheit.checkWith(fahrenheit, "0", "0")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.kelvin, "0", "255.37222") fahrenheit.checkWith(kelvin, "0", "255.37222")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.celsius, "36.6", "2.55556") fahrenheit.checkWith(celsius, "36.6", "2.55556")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.fahrenheit, "36.6", "36.6") fahrenheit.checkWith(fahrenheit, "36.6", "36.6")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.kelvin, "36.6", "275.70556") fahrenheit.checkWith(kelvin, "36.6", "275.70556")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.celsius, "-36.6", "-38.11111") fahrenheit.checkWith(celsius, "-36.6", "-38.11111")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.fahrenheit, "-36.6", "-36.6") fahrenheit.checkWith(fahrenheit, "-36.6", "-36.6")
MyUnitIDS.fahrenheit.checkWith(MyUnitIDS.kelvin, "-36.6", "235.03889") fahrenheit.checkWith(kelvin, "-36.6", "235.03889")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.celsius, "0", "-273.15") kelvin.checkWith(celsius, "0", "-273.15")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.fahrenheit, "0", "-459.67") kelvin.checkWith(fahrenheit, "0", "-459.67")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.kelvin, "0", "0") kelvin.checkWith(kelvin, "0", "0")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.celsius, "36.6", "-236.55") kelvin.checkWith(celsius, "36.6", "-236.55")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.fahrenheit, "36.6", "-393.79") kelvin.checkWith(fahrenheit, "36.6", "-393.79")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.kelvin, "36.6", "36.6") kelvin.checkWith(kelvin, "36.6", "36.6")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.celsius, "-36.6", "-309.75") kelvin.checkWith(celsius, "-36.6", "-309.75")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.fahrenheit, "-36.6", "-525.55") kelvin.checkWith(fahrenheit, "-36.6", "-525.55")
MyUnitIDS.kelvin.checkWith(MyUnitIDS.kelvin, "-36.6", "-36.6") kelvin.checkWith(kelvin, "-36.6", "-36.6")
} }
@Test @Test
fun testTime() { fun testTime() = testWithUnits {
MyUnitIDS.attosecond.checkWith(MyUnitIDS.millisecond, "366000000000", "0.00037") attosecond.checkWith(millisecond, "366000000000", "0.00037")
MyUnitIDS.nanosecond.checkWith(MyUnitIDS.millisecond, "366", "0.00037") nanosecond.checkWith(millisecond, "366", "0.00037")
MyUnitIDS.microsecond.checkWith(MyUnitIDS.millisecond, "366", "0.366") microsecond.checkWith(millisecond, "366", "0.366")
MyUnitIDS.millisecond.checkWith(MyUnitIDS.second, "366", "0.366") millisecond.checkWith(second, "366", "0.366")
MyUnitIDS.jiffy.checkWith(MyUnitIDS.second, "366", "3.66") jiffy.checkWith(second, "366", "3.66")
MyUnitIDS.second.checkWith(MyUnitIDS.millisecond, "366", "366000") second.checkWith(millisecond, "366", "366000")
MyUnitIDS.minute.checkWith(MyUnitIDS.millisecond, "366", "21960000") minute.checkWith(millisecond, "366", "21960000")
MyUnitIDS.hour.checkWith(MyUnitIDS.millisecond, "366", "1317600000") hour.checkWith(millisecond, "366", "1317600000")
MyUnitIDS.day.checkWith(MyUnitIDS.hour, "366", "8784") day.checkWith(hour, "366", "8784")
MyUnitIDS.week.checkWith(MyUnitIDS.hour, "366", "61488") week.checkWith(hour, "366", "61488")
} }
@Test @Test
fun testVolume() { fun testVolume() = testWithUnits {
MyUnitIDS.attoliter.checkWith(MyUnitIDS.millimeter, "1507000000000", "0.00151") attoliter.checkWith(millimeter, "1507000000000", "0.00151")
MyUnitIDS.milliliter.checkWith(MyUnitIDS.liter, "1507", "1.507") milliliter.checkWith(liter, "1507", "1.507")
MyUnitIDS.liter.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "398.10728") liter.checkWith(us_liquid_gallon, "1507", "398.10728")
MyUnitIDS.us_liquid_gallon.checkWith(MyUnitIDS.us_fluid_ounce, "1507", "192896") us_liquid_gallon.checkWith(us_fluid_ounce, "1507", "192896")
MyUnitIDS.us_liquid_quart.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "376.75") us_liquid_quart.checkWith(us_liquid_gallon, "1507", "376.75")
MyUnitIDS.us_liquid_pint.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "188.375") us_liquid_pint.checkWith(us_liquid_gallon, "1507", "188.375")
MyUnitIDS.us_legal_cup.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "94.1875") us_legal_cup.checkWith(us_liquid_gallon, "1507", "94.1875")
MyUnitIDS.us_fluid_ounce.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "11.77344") us_fluid_ounce.checkWith(us_liquid_gallon, "1507", "11.77344")
MyUnitIDS.us_tablespoon.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "5.88672") us_tablespoon.checkWith(us_liquid_gallon, "1507", "5.88672")
MyUnitIDS.us_teaspoon.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "1.96224") us_teaspoon.checkWith(us_liquid_gallon, "1507", "1.96224")
MyUnitIDS.imperial_gallon.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "1809.83154") imperial_gallon.checkWith(us_liquid_gallon, "1507", "1809.83154")
MyUnitIDS.imperial_quart.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "452.45788") imperial_quart.checkWith(us_liquid_gallon, "1507", "452.45788")
MyUnitIDS.imperial_pint.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "226.22894") imperial_pint.checkWith(us_liquid_gallon, "1507", "226.22894")
MyUnitIDS.imperial_cup.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "113.11447") imperial_cup.checkWith(us_liquid_gallon, "1507", "113.11447")
MyUnitIDS.imperial_fluid_ounce.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "11.31145") imperial_fluid_ounce.checkWith(us_liquid_gallon, "1507", "11.31145")
MyUnitIDS.imperial_tablespoon.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "7.06965") imperial_tablespoon.checkWith(us_liquid_gallon, "1507", "7.06965")
MyUnitIDS.imperial_teaspoon.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "2.35655") imperial_teaspoon.checkWith(us_liquid_gallon, "1507", "2.35655")
MyUnitIDS.cubic_millimeter.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "0.0004") cubic_millimeter.checkWith(us_liquid_gallon, "1507", "0.0004")
MyUnitIDS.cubic_centimeter.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "0.39811") cubic_centimeter.checkWith(us_liquid_gallon, "1507", "0.39811")
MyUnitIDS.cubic_meter.checkWith(MyUnitIDS.us_liquid_gallon, "1507", "398107.2829") cubic_meter.checkWith(us_liquid_gallon, "1507", "398107.2829")
MyUnitIDS.cubic_kilometer.checkWith(MyUnitIDS.us_liquid_gallon, "0.0000001507", "39810.72829") cubic_kilometer.checkWith(us_liquid_gallon, "0.0000001507", "39810.72829")
} }
@Test @Test
fun testFlux() { fun testFlux() = testWithUnits {
MyUnitIDS.maxwell.checkWith(MyUnitIDS.milliweber, "68.2", "0.00068") maxwell.checkWith(milliweber, "68.2", "0.00068")
MyUnitIDS.weber.checkWith(MyUnitIDS.milliweber, "68.2", "68200") weber.checkWith(milliweber, "68.2", "68200")
MyUnitIDS.milliweber.checkWith(MyUnitIDS.weber, "68.2", "0.0682") milliweber.checkWith(weber, "68.2", "0.0682")
MyUnitIDS.microweber.checkWith(MyUnitIDS.milliweber, "68.2", "0.0682") microweber.checkWith(milliweber, "68.2", "0.0682")
MyUnitIDS.kiloweber.checkWith(MyUnitIDS.weber, "68.2", "68200") kiloweber.checkWith(weber, "68.2", "68200")
MyUnitIDS.megaweber.checkWith(MyUnitIDS.weber, "68.2", "68200000") megaweber.checkWith(weber, "68.2", "68200000")
MyUnitIDS.gigaweber.checkWith(MyUnitIDS.weber, "68.2", "68200000000") gigaweber.checkWith(weber, "68.2", "68200000000")
} }
@Test @Test
fun testNumberBase() { fun testNumberBase() = testWithUnits {
MyUnitIDS.binary.checkWith(MyUnitIDS.octal, "1000001001", "1011") binary.checkWith(octal, "1000001001", "1011")
MyUnitIDS.ternary.checkWith(MyUnitIDS.decimal, "10112020111", "69430") ternary.checkWith(decimal, "10112020111", "69430")
MyUnitIDS.quaternary.checkWith(MyUnitIDS.quinary, "20321", "4234") quaternary.checkWith(quinary, "20321", "4234")
MyUnitIDS.quinary.checkWith(MyUnitIDS.nonary, "4234", "702") quinary.checkWith(nonary, "4234", "702")
MyUnitIDS.senary.checkWith(MyUnitIDS.nonary, "4234", "1274") senary.checkWith(nonary, "4234", "1274")
MyUnitIDS.septenary.checkWith(MyUnitIDS.nonary, "4234", "2041") septenary.checkWith(nonary, "4234", "2041")
MyUnitIDS.octal.checkWith(MyUnitIDS.undecimal, "42343277", "5107945") octal.checkWith(undecimal, "42343277", "5107945")
MyUnitIDS.nonary.checkWith(MyUnitIDS.duodecimal, "42343287", "69b9a81") nonary.checkWith(duodecimal, "42343287", "69b9a81")
MyUnitIDS.decimal.checkWith(MyUnitIDS.duodecimal, "42343287", "12220273") decimal.checkWith(duodecimal, "42343287", "12220273")
MyUnitIDS.undecimal.checkWith(MyUnitIDS.hexadecimal, "4234a287", "4e3f0c2") undecimal.checkWith(hexadecimal, "4234a287", "4e3f0c2")
MyUnitIDS.duodecimal.checkWith(MyUnitIDS.hexadecimal, "4234a287", "8f30d07") duodecimal.checkWith(hexadecimal, "4234a287", "8f30d07")
MyUnitIDS.tridecimal.checkWith(MyUnitIDS.hexadecimal, "4234a287", "f9c3ff4") tridecimal.checkWith(hexadecimal, "4234a287", "f9c3ff4")
MyUnitIDS.tetradecimal.checkWith(MyUnitIDS.hexadecimal, "bb", "a5") tetradecimal.checkWith(hexadecimal, "bb", "a5")
MyUnitIDS.pentadecimal.checkWith(MyUnitIDS.hexadecimal, "BABE", "9a82") pentadecimal.checkWith(hexadecimal, "BABE", "9a82")
MyUnitIDS.hexadecimal.checkWith(MyUnitIDS.quinary, "FADE", "4023342") hexadecimal.checkWith(quinary, "FADE", "4023342")
} }
@Test @Test
fun testElectrostaticCapacitance() { fun testElectrostaticCapacitance() = testWithUnits {
MyUnitIDS.attofarad.checkWith(MyUnitIDS.nanofarad, "364354322342", "364.35432") attofarad.checkWith(nanofarad, "364354322342", "364.35432")
MyUnitIDS.statfarad.checkWith(MyUnitIDS.microfarad, "123312", "0.1372") statfarad.checkWith(microfarad, "123312", "0.1372")
MyUnitIDS.farad.checkWith(MyUnitIDS.kilofarad, "123312", "123.312") farad.checkWith(kilofarad, "123312", "123.312")
MyUnitIDS.exafarad.checkWith(MyUnitIDS.petafarad, "123312", "123312000") exafarad.checkWith(petafarad, "123312", "123312000")
MyUnitIDS.picofarad.checkWith(MyUnitIDS.nanofarad, "11233", "11.233") picofarad.checkWith(nanofarad, "11233", "11.233")
MyUnitIDS.nanofarad.checkWith(MyUnitIDS.millifarad, "11233", "0.01123") nanofarad.checkWith(millifarad, "11233", "0.01123")
MyUnitIDS.microfarad.checkWith(MyUnitIDS.nanofarad, "1123433", "1123433000") microfarad.checkWith(nanofarad, "1123433", "1123433000")
MyUnitIDS.millifarad.checkWith(MyUnitIDS.nanofarad, "112", "112000000") millifarad.checkWith(nanofarad, "112", "112000000")
MyUnitIDS.kilofarad.checkWith(MyUnitIDS.microfarad, "11132", "11132000000000") kilofarad.checkWith(microfarad, "11132", "11132000000000")
MyUnitIDS.megafarad.checkWith(MyUnitIDS.kilofarad, "11132", "11132000") megafarad.checkWith(kilofarad, "11132", "11132000")
MyUnitIDS.gigafarad.checkWith(MyUnitIDS.petafarad, "11132", "0.01113") gigafarad.checkWith(petafarad, "11132", "0.01113")
MyUnitIDS.petafarad.checkWith(MyUnitIDS.kilofarad, "11132", "11132000000000000") petafarad.checkWith(kilofarad, "11132", "11132000000000000")
} }
private fun String.checkWith(checkingId: String, value: String, expected: String) { private fun String.checkWith(checkingId: String, value: String, expected: String) {
@ -415,4 +415,6 @@ class AllUnitsTest {
// GROUP : testedCount / totalCount // GROUP : testedCount / totalCount
println("${unitGroup.name} : ${history[unitGroup]?.size} / ${allUnitsRepository.getCollectionByGroup(unitGroup).size}") println("${unitGroup.name} : ${history[unitGroup]?.size} / ${allUnitsRepository.getCollectionByGroup(unitGroup).size}")
} }
private fun testWithUnits(block: MyUnitIDS.() -> Unit): Unit = with(MyUnitIDS, block = block)
} }