[MIRROR] Canister max. pressure capacity display fix (#1477)

* 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.

* Canister max. pressure capacity display fix

Co-authored-by: MadMedicineMan <65600900+MadMedicineMan@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-10-27 09:39:40 +01:00
committed by GitHub
co-authored by MadMedicineMan
parent 0de8ba9c1c
commit 9a73dabdc0
3 changed files with 25 additions and 12 deletions
+11 -11
View File
@@ -1,15 +1,15 @@
/datum/unit_test/siunit/Run()
TEST_ASSERT_EQUAL(siunit(1234, "Pa", 1), "1.2 kPa", "")
TEST_ASSERT_EQUAL(siunit(1234, "Pa", 2), "1.23 kPa", "")
TEST_ASSERT_EQUAL(siunit(1234, "Pa", 3), "1.234 kPa", "")
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(1000, "Pa", 4), "1 kPa", "")
TEST_ASSERT_EQUAL(siunit(0, "Pa"), "0 Pa", "")
TEST_ASSERT_EQUAL(siunit(1e6, "Pa"), "1 MPa", "")
TEST_ASSERT_EQUAL(siunit(999e6, "Pa"), "999 MPa", "")
TEST_ASSERT_EQUAL(siunit(999.9e6, "Pa"), "999.9 MPa" , "")
TEST_ASSERT_EQUAL(siunit(999.9e6, "Pa", 0), "1 GPa", "")
TEST_ASSERT_EQUAL(siunit(1e9, "Pa"), "1 GPa", "")
TEST_ASSERT_EQUAL(siunit(3e20, "Pa"), "300000 PPa", "")
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", "")