base64.c revision 3f54fd611f536639ec30dd53c48e5ec1897cc7d9
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1999-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* base64encode()/base64decode() tester
*/
#include <ast.h>
main()
{
register int i;
int testno;
int errors;
ssize_t l;
ssize_t r;
ssize_t t;
unsigned char dat[256];
char buf[1024];
unsigned char pat[16];
static char en[] = "YWJjZGVmZ2hpams=";
static char de[] = "abcdefghijk";
for (i = 0; i < sizeof(dat); i++)
dat[i] = i;
for (i = 0; i < sizeof(dat) - 1; i++)
{
testno++;
if (i > 0)
{
if (l < 0 || l > sizeof(buf))
{
errors++;
continue;
}
if (t != i)
{
errors++;
continue;
}
{
errors++;
continue;
}
}
else
l = 0;
if (r < 0 || r > sizeof(buf) - l)
{
errors++;
continue;
}
if (t != (sizeof(dat) - i))
{
errors++;
continue;
}
{
errors++;
continue;
}
if (t != sizeof(dat))
{
errors++;
continue;
}
{
errors++;
continue;
}
}
for (r = 0; r <= sizeof(pat); r++)
{
testno++;
if (t != (sizeof(de)-1))
{
errors++;
}
else
{
{
errors++;
}
}
}
return 0;
}