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/spacedargs.c

34 lines
910 B
C
Raw Normal View History

#include "../include/uirc.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define cmd "QUIT"
#define arg1 "arg1"
#define arg2 "arg2"
#define trailing "Finished!"
int main(void)
{
char mesg[513] = cmd " " arg1 " " arg2 " :" trailing;
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 (strcmp(parseout.args[0], arg1)) {
printf("Arg1 didn't match, got \"%s\" instead of \"%s\"\n", parseout.args[0], arg1);
return EXIT_FAILURE;
}
if (strcmp(parseout.args[1], arg2)) {
printf("Arg2 didn't match, got \"%s\" instead of \"%s\"\n", parseout.args[1], arg2);
return EXIT_FAILURE;
}
if (strcmp(parseout.args[2], trailing)) {
printf("Trailing didn't match, got \"%s\" instead of \"%s\"\n", parseout.args[2], trailing);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}