aboutsummaryrefslogtreecommitdiff
path: root/tests/base64.scm
blob: 99c02b531e1694b12f77f50e2c73c0e58f09ef7e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-base64)
  #:use-module (guix base64)
  #:use-module (rnrs bytevectors)
  #:use-module (srfi srfi-64))

(define (string->base64 str)
  (base64-encode (string->utf8 str)))

;;; Test vectors from <https://tools.ietf.org/rfc/rfc4648.txt>.

(test-begin "base64")

(test-equal "empty string"
  (string->base64 "")
  "")

(test-equal "f"
  (string->base64 "f")
  "Zg==")

(test-equal "fo"
  (string->base64 "fo")
  "Zm8=")

(test-equal "foo"
  (string->base64 "foo")
  "Zm9v")

(test-equal "foob"
  (string->base64 "foob")
  "Zm9vYg==")

(test-equal "fooba"
  (string->base64 "fooba")
  "Zm9vYmE=")

(test-equal "foobar"
  (string->base64 "foobar")
  "Zm9vYmFy")

(test-end "base64")
lse return #t....* gnu/packages/admin.scm, gnu/packages/algebra.scm, gnu/packages/audio.scm, gnu/packages/backup.scm, gnu/packages/base.scm, gnu/packages/bioinformatics.scm, gnu/packages/cdrom.scm, gnu/packages/chez.scm, gnu/packages/code.scm, gnu/packages/compression.scm, gnu/packages/cross-base.scm, gnu/packages/crypto.scm, gnu/packages/cups.scm, gnu/packages/databases.scm, gnu/packages/dns.scm, gnu/packages/emacs.scm, gnu/packages/emulators.scm, gnu/packages/engineering.scm, gnu/packages/enlightenment.scm, gnu/packages/fpga.scm, gnu/packages/freedesktop.scm, gnu/packages/ftp.scm, gnu/packages/games.scm, gnu/packages/gcc.scm, gnu/packages/geo.scm, gnu/packages/ghostscript.scm, gnu/packages/gl.scm, gnu/packages/glib.scm, gnu/packages/gnome.scm, gnu/packages/gnuzilla.scm, gnu/packages/graphics.scm, gnu/packages/gtk.scm, gnu/packages/guile.scm, gnu/packages/irc.scm, gnu/packages/java.scm, gnu/packages/kerberos.scm, gnu/packages/linux.scm, gnu/packages/lisp.scm, gnu/packages/lxde.scm, gnu/packages/machine-learning.scm, gnu/packages/mail.scm, gnu/packages/maths.scm, gnu/packages/messaging.scm, gnu/packages/monitoring.scm, gnu/packages/mp3.scm, gnu/packages/music.scm, gnu/packages/netpbm.scm, gnu/packages/networking.scm, gnu/packages/node.scm, gnu/packages/nvi.scm, gnu/packages/ocaml.scm, gnu/packages/pdf.scm, gnu/packages/perl.scm, gnu/packages/php.scm, gnu/packages/plotutils.scm, gnu/packages/pretty-print.scm, gnu/packages/profiling.scm, gnu/packages/pulseaudio.scm, gnu/packages/python-crypto.scm, gnu/packages/python.scm, gnu/packages/qt.scm, gnu/packages/robotics.scm, gnu/packages/sawfish.scm, gnu/packages/scanner.scm, gnu/packages/scheme.scm, gnu/packages/scribus.scm, gnu/packages/sdl.scm, gnu/packages/serialization.scm, gnu/packages/shells.scm, gnu/packages/slang.scm, gnu/packages/smalltalk.scm, gnu/packages/ssh.scm, gnu/packages/sync.scm, gnu/packages/syncthing.scm, gnu/packages/tbb.scm, gnu/packages/terminals.scm, gnu/packages/texinfo.scm, gnu/packages/text-editors.scm, gnu/packages/textutils.scm, gnu/packages/tls.scm, gnu/packages/unrtf.scm, gnu/packages/version-control.scm, gnu/packages/video.scm, gnu/packages/vpn.scm, gnu/packages/web.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xorg.scm: In all snippets, report errors using exceptions, or else return #t. Mark H Weaver 2018-03-12gnu: node: Use more unbundled dependencies....* gnu/packages/node.scm (node)[inputs]: Add icu4c and nghttp2. [native-inputs]: Add pkg-config. [arguments]: Add configure flags for using system libraries. [source]: Remove bundled dependencies. Jelle Licht 2018-03-12gnu: node: Update to 9.8.0....* gnu/packages/node.scm (node): Update to 9.8.0. [arguments]: Remove 'doc-only' workaround. Re-enable fixed tests. Jelle Licht 2018-02-02gnu: node: Update to 9.4.0....* gnu/packages/node.scm (node): Update to 9.4.0. [arguments]: Remove all tests that depend on eslint being available. Remove reference to deleted test. Removed networking test. Jelle Licht 2017-12-25gnu: node: Update to 9.3.0....* gnu/packages/patches/node-test-http2-server-rst-stream.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/node.scm (node): Update to 9.3.0. [source]: Remove 'node-test-http2-server-rst-stream.patch'. [arguments]: Remove all tests that depend on eslint being available. Re-enable fixed test. Jelle Licht 2017-11-28gnu: node: Update to 8.9.1....* gnu/packages/node.scm (node): Update to 8.9.1. [source]: Apply 'node-test-http2-server-rst-stream.patch'. [arguments]: Skip 'doc-only' target in 'check', which attempts to use npm to retrieve 'js-yaml' package. Remove test/doctool/test-make-doc.js. Do not remove now-missing test case. Remove new test case that fails in containers due to networking. * gnu/packages/patches/node-test-http2-server-rst-stream.patch: New file. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mike Gerwitz 2017-10-26gnu: node: Update to 8.7.0....* gnu/packages/node.scm (node): Update to 8.7.0. (node)[arguments]: Removed dgram mutlicast test. Removed dns test. Removed broken linter test workaround. Jelle Licht 2017-09-02gnu: node: Update to 8.4.0....* gnu/packages/patches/node-9077.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. * gnu/packages/node.scm (node): Update to 8.4.0. (node)[arguments]: Removed broken linter test. Removed dns test. Jelle Licht 2017-07-18gnu: node: Add search path specification for 'NODE_PATH'....* gnu/packages/node.scm (node)[native-search-paths]: New field. Jelle Licht 2017-06-29gnu: node: Update to 8.1.2....* gnu/packages/node.scm (node): Update to 8.1.2. (node)[arguments]: Disabled more tests. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Jelle Licht 2017-05-23gnu: node: Use unbundled dependencies....* gnu/packages/node.scm (node)[inputs]: Add c-ares and http-parser. [arguments]: Add configure flags for using system libraries. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Jelle Licht 2017-05-23gnu: node: Update to 7.10.0....* gnu/packages/node.scm (node): Update to 7.10.0. (node)[arguments]: Disabled more tests. * gnu/packages/patches/node-9077.patch: Delete incompatible patch file. Recreate patch file from node pull request 9077. Signed-off-by: Marius Bakke <mbakke@fastmail.com> Jelle Licht 2017-04-17gnu: node: Actually set timeout to 1 h....* gnu/packages/node.scm (node)[properties]: Actually set timeout to 1 h. Danny Milosavljevic 2017-04-17gnu: node: Update to 7.8.0....* gnu/packages/node.scm (node): Update to 7.8.0. [properties]: Add timeout of 1 h. Jelle Licht 2017-01-23gnu: node: Don't replace 'sh' reference with 'bash'....* gnu/packages/node.scm (node)[arguments]: Use (which "sh") instead of (which "bash") in 'patch-files' phase. Leo Famulari