2020-07-10 16:03:26 +00:00
|
|
|
#include "../include/uirc.h"
|
2020-09-01 09:49:37 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2020-07-10 16:03:26 +00:00
|
|
|
|
2020-09-26 21:22:05 +00:00
|
|
|
#define nickname "nick"
|
|
|
|
#define username "user"
|
|
|
|
#define hostname "host"
|
|
|
|
#define arg2 "Finished!"
|
|
|
|
|
2020-07-10 16:03:26 +00:00
|
|
|
int main(void)
|
|
|
|
{
|
2020-09-26 21:22:05 +00:00
|
|
|
char mesg[2][513] = {
|
2020-07-22 17:18:44 +00:00
|
|
|
#ifdef UIRC_IRCV3
|
2020-09-26 21:22:05 +00:00
|
|
|
"@+msgid=1s32;time;+reply;account=x "
|
2020-07-22 17:18:44 +00:00
|
|
|
#endif
|
2020-09-26 21:22:05 +00:00
|
|
|
":" nickname "!" username "@" hostname " QUIT arg1 :" arg2,
|
2020-10-10 10:30:05 +00:00
|
|
|
"001 hell :sup cj"};
|
2020-09-26 21:22:05 +00:00
|
|
|
IRC_Message parseout = {0};
|
2020-07-10 16:03:26 +00:00
|
|
|
int res = 0;
|
2020-09-26 21:22:05 +00:00
|
|
|
if ((res = Tok_mesg(mesg[0], &parseout)) <= 0) {
|
2020-07-10 16:03:26 +00:00
|
|
|
printf("String could not be tokenized. %i\n", res);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2020-10-02 12:40:15 +00:00
|
|
|
if (parseout.args[1] == NULL || strcmp(parseout.args[1], arg2) != 0) {
|
2020-09-26 21:22:05 +00:00
|
|
|
printf("Unexpected result. Got %s instead of %s\n", parseout.args[1], arg2);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2020-10-02 12:40:15 +00:00
|
|
|
if (parseout.name.user == NULL || strcmp(parseout.name.user, username) != 0) {
|
2020-09-26 21:22:05 +00:00
|
|
|
printf("Unexpected result. Got %s instead of %s\n", parseout.name.user, username);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
if (parseout.cmd != QUIT) {
|
|
|
|
printf("Unexpected command result. Got %i instead of %i\n", parseout.cmd, QUIT);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
if ((res = Tok_mesg(mesg[1], &parseout)) <= 0) {
|
|
|
|
printf("String could not be tokenized. %i\n", res);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
if (parseout.cmd != 1) {
|
|
|
|
printf("Unexpected command result. Got %i instead of %i\n", parseout.cmd, 1);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2020-07-10 16:03:26 +00:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
2020-09-26 21:22:05 +00:00
|
|
|
|