WHY2/src/lib/test/main.c

32 lines
582 B
C
Raw Normal View History

2022-03-20 18:12:25 +01:00
#include <stdio.h>
#include <stdlib.h>
2022-04-27 19:18:30 +02:00
#include <string.h>
2022-03-20 18:12:25 +01:00
2022-05-01 16:23:07 +02:00
#include <why2/encrypter.h>
#include <why2/decrypter.h>
2022-05-02 18:01:52 +02:00
#include <why2/flags.h>
2022-03-20 18:12:25 +01:00
2022-05-06 17:43:00 +02:00
int main(void)
2022-03-20 18:12:25 +01:00
{
2022-05-06 17:43:00 +02:00
inputFlags flags =
{
2022-05-06 17:43:00 +02:00
1, //SKIP CHECK
0, //NO OUTPUT
};
2022-05-06 17:43:00 +02:00
outputFlags encrypted = encryptText(TEST_TEXT, TEST_KEY, flags);
encrypted = decryptText(encrypted.outputText, TEST_KEY, flags);
2022-03-20 18:12:25 +01:00
2022-05-06 17:43:00 +02:00
if (strcmp(encrypted.outputText, TEST_TEXT) == 0)
2022-04-27 19:18:30 +02:00
{
printf("Test successful!\n");
}
else
{
fprintf(stderr, "Test failed!\n");
exit(1);
}
2022-03-20 18:12:25 +01:00
return 0;
2022-04-26 19:05:57 +02:00
}