created test code

This commit is contained in:
Václav Šmejkal 2022-04-27 19:18:30 +02:00
parent 6f38a68020
commit 3f5724dc0b

View File

@ -1,17 +1,28 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../include/encrypter.h"
#include "../../include/decrypter.h"
#define TEST_TEXT "Pepa smrdí."
#define TEST_KEY "lZwOBFvjJEmaYRIaKsALKLkSeJvXhFPbZIRNFbjQRNyiOuLTexhgOpObHzyQgNT"
int
main(int args, char *argv[])
{
char *text = encryptText("Pepa smrdí.", "lZwOBFvjJEmaYRIaKsALKLkSeJvXhFPbZIRNFbjQRNyiOuLTexhgOpObHzyQgNT");
printf("%s\n", text);
char *text = encryptText(TEST_TEXT, TEST_KEY);
text = decryptText(text, TEST_KEY);
text = decryptText(text, "lZwOBFvjJEmaYRIaKsALKLkSeJvXhFPbZIRNFbjQRNyiOuLTexhgOpObHzyQgNT");
printf("%s\n", text);
if (strcmp(text, TEST_TEXT) == 0)
{
printf("Test successful!\n");
}
else
{
fprintf(stderr, "Test failed!\n");
exit(1);
}
free(text);
return 0;