summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/bindat-tests.el
diff options
context:
space:
mode:
authorAndrea Corallo <akrl@sdf.org>2020-04-29 20:25:23 +0100
committerAndrea Corallo <akrl@sdf.org>2020-04-29 20:25:23 +0100
commitab66e61b58cd872379e7a9ce301bf0bd17507282 (patch)
tree6eeae16ca85f2c93e2f04ea5c9d31fb3eda45b96 /test/lisp/emacs-lisp/bindat-tests.el
parentf8b254d1957a86645bfcc6ce452d97b9286910a2 (diff)
parentb56401f3849cf6d00717ab8a64a221f2c01455a6 (diff)
downloademacs-ab66e61b58cd872379e7a9ce301bf0bd17507282.tar.gz
emacs-ab66e61b58cd872379e7a9ce301bf0bd17507282.tar.bz2
emacs-ab66e61b58cd872379e7a9ce301bf0bd17507282.zip
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'test/lisp/emacs-lisp/bindat-tests.el')
-rw-r--r--test/lisp/emacs-lisp/bindat-tests.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bindat-tests.el b/test/lisp/emacs-lisp/bindat-tests.el
index f8efa7902a4..14f95a8bf80 100644
--- a/test/lisp/emacs-lisp/bindat-tests.el
+++ b/test/lisp/emacs-lisp/bindat-tests.el
@@ -96,4 +96,20 @@
(dest-ip .
[192 168 1 100]))))))
+(ert-deftest bindat-test-format-vector ()
+ (should (equal (bindat-format-vector [1 2 3] "%d" "x" 2) "1x2"))
+ (should (equal (bindat-format-vector [1 2 3] "%d" "x") "1x2x3")))
+
+(ert-deftest bindat-test-vector-to-dec ()
+ (should (equal (bindat-vector-to-dec [1 2 3]) "1.2.3"))
+ (should (equal (bindat-vector-to-dec [2048 1024 512] ".") "2048.1024.512")))
+
+(ert-deftest bindat-test-vector-to-hex ()
+ (should (equal (bindat-vector-to-hex [1 2 3]) "01:02:03"))
+ (should (equal (bindat-vector-to-hex [2048 1024 512] ".") "800.400.200")))
+
+(ert-deftest bindat-test-ip-to-string ()
+ (should (equal (bindat-ip-to-string [192 168 0 1]) "192.168.0.1"))
+ (should (equal (bindat-ip-to-string "\300\250\0\1") "192.168.0.1")))
+
;;; bindat-tests.el ends here