okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
061a28583
main
1"""One engine, one size: the Terminal and the app both say decimal megabytes, rounded half up (apps/host/tests/size-label.test.mjs has the 2same numbers). 606,513,890 bytes is 607 MB in both places, never 606 in one and 607 in another.""" 3import unittest 4 5from strata_cli import update_cmd 6from strata_control import updater 7 8# the same samples as the app's test: (bytes, megabytes) 9SAMPLES = [(606513890 ,607 ), (581299508 ,581 ), (1 ,1 ), (0 ,1 ), (999_999 ,1 ), (1_500_000 ,2 ), (2_499_999 ,2 )] 10 11 12class SizeLabel (unittest .TestCase ): 13def test_megabytes_match_the_apps_figures (self ): 14for size ,expected in SAMPLES : 15self .assertEqual (updater .megabytes (size ),expected ,size ) 16 17def test_the_terminal_offer_line_uses_the_same_helper (self ): 18self .assertEqual (update_cmd ._mib (606513890 ),"607 MB" ) 19self .assertEqual (update_cmd ._mib (581299508 ),"581 MB" ) 20 21 22if __name__ == "__main__" : 23unittest .main ()