#include "../include/uirc.h" #include #include #include #define nickname "nick" #define username "user" #define hostname "host" #define arg2 "Finished!" int main(void) { char mesg[2][513] = { #ifdef UIRC_IRCV3 "@+msgid=1s32;time;+reply;account=x " #endif ":" nickname "!" username "@" hostname " QUIT arg1 :" arg2, "001 hell :sup cj" }; IRC_Message parseout = {0}; int res = 0; if ((res = Tok_mesg(mesg[0], &parseout)) <= 0) { printf("String could not be tokenized. %i\n", res); return EXIT_FAILURE; } if (parseout.args[1] == NULL || strcmp(parseout.args[1], arg2)) { printf("Unexpected result. Got %s instead of %s\n", parseout.args[1], arg2); return EXIT_FAILURE; } if (parseout.name.user == NULL || strcmp(parseout.name.user, username)) { 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; } return EXIT_SUCCESS; }