Derive([("out","/nix/store/yd0v41r8kj49xcjric62gk47lss9vdyg-hurd-qemu-test-build","","")],[("/nix/store/2fgw8gkxs1k8hfcsvir3q9wnkifdzs2s-bash-4.2-p20.drv",["out"]),("/nix/store/31n2fn5h1gydqs3a9zm5g40d2f886i7g-gnused-4.2.1-i586-pc-gnu.drv",["out"]),("/nix/store/34y69yzzb9a1v1fmixiqfhip9s57pybf-gnugrep-2.10-i586-pc-gnu.drv",["out"]),("/nix/store/6n80yhr7cwip45w8rccyk4bp7g7zlkwq-gnu-global-user-environment.drv",["out"]),("/nix/store/88ymj8xwrkmadyabbc1z96x4prabkhsx-gnumake-3.82-i586-pc-gnu.drv",["out"]),("/nix/store/8c61y42zw57axxixl0wikq6vszjbf9bw-qemu-kvm-0.15.1.drv",["out"]),("/nix/store/8dd520i02y7pkh5ynm7d5jb2lk0m7wzn-mig-20100512-i586-pc-gnu.drv",["out"]),("/nix/store/b4lcngrsl838jg37yn510g888nlf0f1v-gawk-4.0.0-i586-pc-gnu.drv",["out"]),("/nix/store/c4bq6crxpl4y9wd18fkvn81vj93m9wph-findutils-4.4.2-i586-pc-gnu.drv",["out"]),("/nix/store/dgbh8qzl4rr89jsrlsy382z84lmfwsj1-bzip2-1.0.6-i586-pc-gnu.drv",["out"]),("/nix/store/dsplzdbcqwgi9ybb7pfk5z9w6vxbn48h-diffutils-3.2-i586-pc-gnu.drv",["out"
;;; 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")