Files
Bubberstation/code/modules/unit_tests/siunit.dm
SkyratBot cf96a02160 [MIRROR] Extends the metric prefixes. (#26804)
* Extends the metric prefixes. (#81739)

## About The Pull Request
Extends the metric prefixes some things will display. Adds the quecto,
ronto, yocto, zepto. atto, exa, zetta, yotta, ronna and quetta prefixes.
## Why It's Good For The Game
Makes it easier to read the numbers when someone manages to break atmos
or whatever.
## Changelog
🆑
qol: Extended the metric prefixes.
/🆑

* Extends the metric prefixes.

---------

Co-authored-by: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
2024-03-08 19:21:29 -05: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(3e32), "300000 QPa", "")