#include <stdio.h>
#include <limits.h> // realpath
#include <stdlib.h> // mkdtemp, realpath
#include <unistd.h> // chdir
#include <string.h> // strlen, strncpy, strrchr
#include "inkscapestream.h"
#include "base64stream.h"
#include "gzipstream.h"
#include "stringstream.h"
#include "uristream.h"
#include "xsltstream.h"
// quick way to pass the name of the executable into the test
// names and path storage for other tests
bool testUriStream()
{
printf("######### UriStream copy ############\n");
return true;
}
bool testWriter()
{
printf("######### OutputStreamWriter ############\n");
return true;
}
bool testStdWriter()
{
printf("######### StdWriter ############\n");
return true;
}
bool testBase64()
{
printf("######### Base64 Out ############\n");
printf("######### Base64 In ############\n");
return true;
}
bool testXslt()
{
printf("######### XSLT Sheet ############\n");
printf("######### XSLT Input ############\n");
printf("######### XSLT Output ############\n");
return true;
}
bool testGzip()
{
printf("######### Gzip Output ############\n");
printf("######### Gzip Input ############\n");
return true;
}
bool doTest()
{
if (!testUriStream())
{
return false;
}
if (!testWriter())
{
return false;
}
if (!testStdWriter())
{
return false;
}
if (!testBase64())
{
return false;
}
if (!testXslt())
{
return false;
}
if (!testGzip())
{
return false;
}
return true;
}
{
{
printf("merging paths would be too long\n");
exit(1);
}
if (!ptr)
{
exit(1);
}
}
{
{
perror("realpath");
return 1;
}
// create temp files somewhere else instead of current dir
// TODO: clean them up too
char * testpath2;
if (!testpath2)
{
perror("mkdtemp");
return 1;
}
{
perror("chdir");
return 1;
}
if (!doTest())
{
printf("#### Test failed\n");
return 1;
}
else
{
printf("##### Test succeeded\n");
}
return 0;
}