Allow 'browse-url-emacs' to fetch URL in the selected window
[emacs.git] / test / lisp / md4-tests.el
blobb011e8b774138a8204de82926a0d0d95665ce0c4
1 ;;; md4-tests.el --- tests for md4.el -*- lexical-binding: t -*-
3 ;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
5 ;; Author: Mark Oteiza <mvoteiza@udel.edu>
6 ;; Maintainer: emacs-devel@gnu.org
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
23 ;;; Commentary:
25 ;;; Code:
27 (require 'ert)
28 (require 'md4)
30 (defun md4-tests-digest->hex (str)
31 "Print digest STR in hexadecimal."
32 (mapconcat (lambda (x) (format "%02x" x)) str ""))
34 (ert-deftest md4-test-rfc1320 ()
35 "Verify the test suite results in RFC 1320.
36 See <https://tools.ietf.org/html/rfc1320>."
37 (should
38 (equal (md4-tests-digest->hex (md4 "" 0))
39 "31d6cfe0d16ae931b73c59d7e0c089c0"))
40 (should
41 (equal (md4-tests-digest->hex (md4 "a" 1))
42 "bde52cb31de33e46245e05fbdbd6fb24"))
43 (should
44 (equal (md4-tests-digest->hex (md4 "abc" 3))
45 "a448017aaf21d8525fc10ae87aa6729d"))
46 (should
47 (equal (md4-tests-digest->hex (md4 "message digest" 14))
48 "d9130a8164549fe818874806e1c7014b"))
49 (should
50 (equal (md4-tests-digest->hex (md4 "abcdefghijklmnopqrstuvwxyz" 26))
51 "d79e1c308aa5bbcdeea8ed63df412da9"))
52 (should
53 (equal (md4-tests-digest->hex
54 (md4 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" 62))
55 "043f8582f241db351ce627e153e7f0e4"))
56 (should
57 (equal (md4-tests-digest->hex
58 (md4 "12345678901234567890123456789012345678901234567890123456789012345678901234567890" 80))
59 "e33b4ddc9c38f2199c3e7b164fcc0536")))
61 ;;; md4-tests.el ends here