This repository has been archived on 2021-04-17. You can view files and clone it, but cannot push or open issues or pull requests.
uIRC/tests/tagtok.c

25 lines
686 B
C
Raw Normal View History

2020-07-10 16:03:26 +00:00
#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;
}