Index: openacs-4/packages/acs-lang/tcl/test/acs-lang-localization-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/tcl/test/acs-lang-localization-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/packages/acs-lang/tcl/test/acs-lang-localization-procs.tcl 22 Jul 2018 09:46:48 -0000 1.4 +++ openacs-4/packages/acs-lang/tcl/test/acs-lang-localization-procs.tcl 1 Jul 2019 14:47:06 -0000 1.4.2.1 @@ -60,7 +60,67 @@ } } +aa_register_case \ + -cats {api smoke production_safe} \ + -procs lc_content_size_pretty \ + lang_test__lc_content_size_pretty { + Test lc_content_size_pretty proc + + @author Héctor Romojaro + @creation-date 2019-06-25 + +} { + # Localized bytes + set bytes [lc_get "bytes"] + + aa_equals "No arguments binary" [lc_content_size_pretty -standard "binary"] "[lc_numeric 0] $bytes" + aa_equals "No arguments legacy" [lc_content_size_pretty -standard "legacy"] "[lc_numeric 0] $bytes" + aa_equals "No arguments decimal" [lc_content_size_pretty] "[lc_numeric 0] $bytes" + aa_equals "Empty value binary" [lc_content_size_pretty -size "" -standard "binary"] "[lc_numeric 0] $bytes" + aa_equals "Empty value legacy" [lc_content_size_pretty -size "" -standard "legacy"] "[lc_numeric 0] $bytes" + aa_equals "Empty value decimal" [lc_content_size_pretty -size ""] "[lc_numeric 0] $bytes" + aa_equals "1.0 KiB" [lc_content_size_pretty -size 1024 -standard "binary"] "[lc_numeric 1.0] KiB" + aa_equals "1.0 KB" [lc_content_size_pretty -size 1024 -standard "legacy"] "[lc_numeric 1.0] KB" + aa_equals "1.0 KB" [lc_content_size_pretty -size 1000] "[lc_numeric 1.0] kB" + aa_equals "1.0 MiB" [lc_content_size_pretty -size 1048576 -standard "binary"] "[lc_numeric 1.0] MiB" + aa_equals "1.0 MB" [lc_content_size_pretty -size 1048576 -standard "legacy"] "[lc_numeric 1.0] MB" + aa_equals "1.0 MB" [lc_content_size_pretty -size 1000000] "[lc_numeric 1.0] MB" + aa_equals "1.0 GiB" [lc_content_size_pretty -size 1073741824 -standard "binary"] "[lc_numeric 1.0] GiB" + aa_equals "1.0 GB" [lc_content_size_pretty -size 1073741824 -standard "legacy"] "[lc_numeric 1.0] GB" + aa_equals "1.0 GB" [lc_content_size_pretty -size 1000000000] "[lc_numeric 1.0] GB" + aa_equals "1.0 TiB" [lc_content_size_pretty -size 1099511627800 -standard "binary"] "[lc_numeric 1.0] TiB" + aa_equals "1.0 TB" [lc_content_size_pretty -size 1099511627800 -standard "legacy"] "[lc_numeric 1.0] TB" + aa_equals "1.0 TB" [lc_content_size_pretty -size 1000000000000] "[lc_numeric 1.0] TB" + aa_equals "1.0 PiB" [lc_content_size_pretty -size 1125899906842620 -standard "binary"] "[lc_numeric 1.0] PiB" + aa_equals "1.0 PB" [lc_content_size_pretty -size 1125899906842620 -standard "legacy"] "[lc_numeric 1.0] PB" + aa_equals "1.0 PB" [lc_content_size_pretty -size 1000000000000000] "[lc_numeric 1.0] PB" + aa_equals "1.0 EiB" [lc_content_size_pretty -size 1152921504606850000 -standard "binary"] "[lc_numeric 1.0] EiB" + aa_equals "1.0 EB" [lc_content_size_pretty -size 1152921504606850000 -standard "legacy"] "[lc_numeric 1.0] EB" + aa_equals "1.0 EB" [lc_content_size_pretty -size 1000000000000000000] "[lc_numeric 1.0] EB" + aa_equals "1.0 ZiB" [lc_content_size_pretty -size 1180591620717410000000 -standard "binary"] "[lc_numeric 1.0] ZiB" + aa_equals "1.0 ZB" [lc_content_size_pretty -size 1180591620717410000000 -standard "legacy"] "[lc_numeric 1.0] ZB" + aa_equals "1.0 ZB" [lc_content_size_pretty -size 1000000000000000000000] "[lc_numeric 1.0] ZB" + aa_equals "1.0 YiB" [lc_content_size_pretty -size 1208925819614630000000000 -standard "binary"] "[lc_numeric 1.0] YiB" + aa_equals "1.0 YB" [lc_content_size_pretty -size 1208925819614630000000000 -standard "legacy"] "[lc_numeric 1.0] YB" + aa_equals "1.0 YB" [lc_content_size_pretty -size 1000000000000000000000000] "[lc_numeric 1.0] YB" + aa_equals "1.3 YiB" [lc_content_size_pretty -size 1571603565499020000000000 -standard "binary"] "[lc_numeric 1.3] YiB" + aa_equals "1.3 YB" [lc_content_size_pretty -size 1571603565499020000000000 -standard "legacy"] "[lc_numeric 1.3] YB" + aa_equals "1.3 YB" [lc_content_size_pretty -size 1300000000000000000000000] "[lc_numeric 1.3] YB" + aa_equals "1.000 KiB" [lc_content_size_pretty -size 1024 -precision 3 -standard "binary"] "[lc_numeric 1.000] KiB" + aa_equals "1.000 KB" [lc_content_size_pretty -size 1024 -precision 3 -standard "legacy"] "[lc_numeric 1.000] KB" + aa_equals "1.000 kB" [lc_content_size_pretty -size 1000 -precision 3] "[lc_numeric 1.000] kB" + aa_equals "1 KiB" [lc_content_size_pretty -size 1024 -precision 0 -standard "binary"] "[lc_numeric 1] KiB" + aa_equals "1 KB" [lc_content_size_pretty -size 1024 -precision 0 -standard "legacy"] "[lc_numeric 1] KB" + aa_equals "1 kB" [lc_content_size_pretty -size 1000 -precision 0] "[lc_numeric 1] kB" + aa_equals "1 KiB" [lc_content_size_pretty -size 1044 -precision 0 -standard "binary"] "[lc_numeric 1] KiB" + aa_equals "1 KB" [lc_content_size_pretty -size 1044 -precision 0 -standard "legacy"] "[lc_numeric 1] KB" + aa_equals "1 kB" [lc_content_size_pretty -size 1080 -precision 0] "[lc_numeric 1] kB" + aa_equals "1.01953 -> 1.020 KiB" [lc_content_size_pretty -size 1044 -precision 3 -standard "binary"] "[lc_numeric 1.020] KiB" + aa_equals "1.01953 -> 1.020 KB" [lc_content_size_pretty -size 1044 -precision 3 -standard "legacy"] "[lc_numeric 1.020] KB" + aa_equals "1.080 kB" [lc_content_size_pretty -size 1080 -precision 3] "[lc_numeric 1.080] kB" +} + # Local variables: # mode: tcl # tcl-indent-level: 4