#!/bin/sh

# Copyright (C) 2004, 2005 Simon Josefsson.
#
# This file is part of Base64.
#
# Base64 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 2, or (at your option)
# any later version.
#
# Base64 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 Base64; see the file COPYING.  If not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.

BASE64=../src/base64

out=`$BASE64 -d ""`
test "$?" != 0 &&
  echo "Test 1 failed: $out" && exit 1
test "$out" != "" &&
  echo "Test 1 data failed: $out" && exit 1

out=`$BASE64 -d YQ==`
test "$?" != 0 &&
  echo "Test 2 failed: $out" && exit 1
test "$out" != "a" &&
  echo "Test 2 data failed: $out" && exit 1

out=`$BASE64 -d YWI=`
test "$?" != 0 &&
  echo "Test 3 failed: $out" && exit 1
test "$out" != "ab" &&
  echo "Test 3 data failed: $out" && exit 1

out=`$BASE64 -d YWJj`
test "$?" != 0 &&
  echo "Test 4 failed: $out" && exit 1
test "$out" != "abc" &&
  echo "Test 4 data failed: $out" && exit 1

out=`$BASE64 -d YWJjZA==`
test "$?" != 0 &&
  echo "Test 5 failed: $out" && exit 1
test "$out" != "abcd" &&
  echo "Test 5 data failed: $out" && exit 1

out=`$BASE64 -d YWJjZGU=`
test "$?" != 0 &&
  echo "Test 6 failed: $out" && exit 1
test "$out" != "abcde" &&
  echo "Test 6 data failed: $out" && exit 1

out=`$BASE64 -d YWJjZGVm`
test "$?" != 0 &&
  echo "Test 7 failed: $out" && exit 1
test "$out" != "abcdef" &&
  echo "Test 7 data failed: $out" && exit 1

out=`$BASE64 -d YWJjZGVmZw==`
test "$?" != 0 &&
  echo "Test 8 failed: $out" && exit 1
test "$out" != "abcdefg" &&
  echo "Test 8 data failed: $out" && exit 1

exit 0
