2021-03-05 17:16:26 +00:00
|
|
|
/*
|
|
|
|
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
|
2021-03-11 22:52:30 +00:00
|
|
|
* Copyright (c) 2019-2021 Alex-David Denes
|
2021-03-05 17:16:26 +00:00
|
|
|
*
|
|
|
|
* uIRC is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* uIRC is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with uIRC. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "common.h" // expect() print_irc_message()
|
|
|
|
#include "uirc.h" // uirc_* IRC_*
|
|
|
|
|
|
|
|
#include <stdio.h> // fprintf()
|
|
|
|
#include <stdlib.h> // EXIT_*
|
|
|
|
#include <string.h> // strcmp()
|
|
|
|
|
|
|
|
#define TRAILING "random stuff here"
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
const char* str = "NOTICE 0 1 2 3 4 5 6 7 8 9 10 11 12 13 " TRAILING "\r\n";
|
|
|
|
|
|
|
|
IRC_Message* m = NULL;
|
|
|
|
if ((m = uirc_tokenizer_message(str)) == NULL) {
|
|
|
|
fprintf(stderr, "Failed to convert string to IRC_Message struct.\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
if (strcmp(m->args[IRC_MAXARGS - 1], TRAILING) != 0) {
|
|
|
|
fprintf(stderr, "Trailing was parsed incorrectly, got %s instead of %s\n", m->args[IRC_MAXARGS - 1], TRAILING);
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
2021-03-11 22:33:08 +00:00
|
|
|
uirc_struct_free(m, IRC_STRUCT_MESSAGE);
|
2021-03-05 17:16:26 +00:00
|
|
|
free(m);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|