feat(wpcarro/emacs): Package bytes.el

Another meh package, but let's finish the job and package it up.

Change-Id: I7852a776c93c8c6717878a5ee0742287d2d23052
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7394
Reviewed-by: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
This commit is contained in:
William Carroll 2022-11-24 22:20:10 -08:00 committed by wpcarro
parent fb7f461cff
commit bbad770cf2
3 changed files with 62 additions and 37 deletions

View file

@ -0,0 +1,18 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ert)
(require 'bytes)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(ert-deftest bytes-to-string ()
(should (equal "1000B" (bytes-to-string 1000)))
(should (equal "2KB" (bytes-to-string (* 2 bytes-kb))))
(should (equal "17MB" (bytes-to-string (* 17 bytes-mb))))
(should (equal "419GB" (bytes-to-string (* 419 bytes-gb))))
(should (equal "999TB" (bytes-to-string (* 999 bytes-tb))))
(should (equal "2PB" (bytes-to-string (* 2 bytes-pb)))))