WHY2/src/lib/test/main.c

33 lines
561 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
int
2022-04-29 17:49:51 +02:00
main(int argc, char *argv[])
2022-03-20 18:12:25 +01:00
{
if (argc == 2 && strcmp(argv[1], "skipCheck") == 0)
{
2022-05-02 18:01:52 +02:00
setSkipCheck(1);
}
2022-04-27 19:18:30 +02:00
char *text = encryptText(TEST_TEXT, TEST_KEY);
text = decryptText(text, TEST_KEY);
2022-03-20 18:12:25 +01:00
2022-04-27 19:18:30 +02:00
if (strcmp(text, TEST_TEXT) == 0)
{
printf("Test successful!\n");
}
else
{
fprintf(stderr, "Test failed!\n");
exit(1);
}
2022-03-20 18:12:25 +01:00
free(text);
return 0;
2022-04-26 19:05:57 +02:00
}