Add few tests
This commit is contained in:
parent
91d4ac1250
commit
081821c8bc
|
@ -0,0 +1,22 @@
|
|||
#include "../include/uirc.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char mesg[513] = {0};
|
||||
IRC_Tags input = {
|
||||
.time = {.value = "now", .clientbound = true},
|
||||
.msgid = {.value = "", .clientbound = false}};
|
||||
int res = 0;
|
||||
if ((res = Assm_tags(mesg, &input)) <= 0) {
|
||||
printf("String could not be assembled. %i\n", res);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (strcmp(mesg, "@+time=now;msgid") && strcmp(mesg, "@msgid;+time=now")) {
|
||||
printf("String was not assembled properly. Have %s\n", mesg);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
#include "../include/uirc.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char mesg[513] = "@msgid=1s32;+time QUIT";
|
||||
IRC_Message parseout;
|
||||
int res = 0;
|
||||
if ((res = Tok_mesg(mesg, &parseout)) <= 0) {
|
||||
printf("String could not be tokenized. %i\n", res);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (parseout.tags.msgid.value == NULL || strcmp(parseout.tags.msgid.value, "1s32")) {
|
||||
printf("Message ID was not properly parsed.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (parseout.tags.time.value == NULL || *parseout.tags.time.value != '\0' || !parseout.tags.time.clientbound) {
|
||||
printf("Time was not properly parsed.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
#include "../include/uirc.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "string.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char mesg[513] = "@+msgid=1s32;time;+reply;account=x :nick!user@host QUIT :Finished!";
|
||||
IRC_Message parseout;
|
||||
int res = 0;
|
||||
if ((res = Tok_mesg(mesg, &parseout)) <= 0) {
|
||||
printf("String could not be tokenized. %i\n", res);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
Reference in New Issue