aboutsummaryrefslogtreecommitdiff
;;; 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")
/td>Julien Lepiller 2021-04-18nls: Add Chinese (Traditional) translation....Julien Lepiller 2021-04-18nls: Add Korean translation....Julien Lepiller 2021-04-18nls: Add Italian translation....Julien Lepiller 2021-04-18nls: Add Persian translation....Julien Lepiller 2021-04-18nls: Add Slovak translation....Julien Lepiller 2021-04-18nls: Add Portuguese (Brazil) translation of the manual.Julien Lepiller 2021-04-18nls: Add French translation of the cookbook.Julien Lepiller 2021-04-18doc: Fix pxref translation issue....Julien Lepiller 2020-10-27doc: Fix xref translation macro....Ludovic Courtès 2020-05-22doc: Update 'Bootstrapping' for further binary seed reduction....Jan Nieuwenhuizen 2020-04-24doc: Ensure guix-daemon is built before creating guix-daemon.1....Marius Bakke 2020-04-23build: Don't build man pages when cross-compiling....Ludovic Courtès 2020-04-23doc: Build more man pages....Ludovic Courtès 2020-04-16doc: Document building and installing from JSON files....Ricardo Wurmus 2020-02-17doc: Add German Cookbook translation....Florian Pelz 2019-09-24Merge branch 'master' into core-updatesLudovic Courtès 2019-09-18doc: Add Guix Cookbook....Ricardo Wurmus 2019-05-25Merge branch 'staging' into core-updatesMarius Bakke 2019-05-13doc: Add Russian translation....Ludovic Courtès 2019-05-04doc: Warn about missing entries in htmlxref.cnf....Ludovic Courtès 2019-05-01Merge branch 'master' into core-updatesMarius Bakke 2019-04-24doc: Add Simplified Chinese translation....Ludovic Courtès 2019-04-23doc: Add Spanish translation....Miguel Ángel Arruga Vivas 2019-03-14Merge branch 'staging' into core-updatesMarius Bakke 2019-03-13doc: Document the graphical installer some more....Ludovic Courtès 2018-12-11Merge branch 'master' into core-updatesMarius Bakke 2018-11-01doc: Add German translation....Julien Lepiller 2018-09-23doc: Describe the Reduced Binary Seed bootstrap....Jan Nieuwenhuizen 2018-04-29build: Use only one domain for guix-manual....Julien Lepiller 2018-04-25build: Add silent rules for Texinfo xref translation....Ludovic Courtès 2018-04-19gnu: doc: Add French documentation....Julien Lepiller 2018-04-19gnu: doc: Allow documentation to be translated....Julien Lepiller 2018-01-20build: Declare “doc/guix.texi“ dependencies....Mathieu Lirzin