Files
Bubberstation/code/modules/unit_tests/siunit.dm
MadMedicineMan d29c75d1eb Canister max. pressure capacity display fix (#54600)
Atmos canisters now display their correct max. pressure capacity. Game code always expects kPa, code for SI-prefix-generation only expects the base unit (here: Pa), so the displayed value was always off by the factor 1000.
2020-10-26 12:23:54 -03:00

16 lines
929 B
Plaintext

/datum/unit_test/siunit/Run()
TEST_ASSERT_EQUAL(siunit(0.5345, "A", 0), "535 mA", "")
TEST_ASSERT_EQUAL(siunit(0.5344, "A", 0), "534 mA", "")
TEST_ASSERT_EQUAL(siunit(-0.5344, "A", 0), "-534 mA", "")
TEST_ASSERT_EQUAL(siunit_pressure(1.234, 1), "1.2 kPa", "") // test for pascal require *10e-3, as the game thinks in kPa, the proc siunit in Pa
TEST_ASSERT_EQUAL(siunit_pressure(1.234, 2), "1.23 kPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(1.234, 3), "1.234 kPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(1, 4), "1 kPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(0), "0 Pa", "")
TEST_ASSERT_EQUAL(siunit_pressure(1e3), "1 MPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(999e3), "999 MPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(999.9e3), "999.9 MPa" , "")
TEST_ASSERT_EQUAL(siunit_pressure(999.9e3, 0), "1 GPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(1e6), "1 GPa", "")
TEST_ASSERT_EQUAL(siunit_pressure(3e17), "300000 PPa", "")