2021-03-06 22:23:55 +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-06 22:23:55 +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 TAGKEY "wow"
|
|
|
|
#define TAGKEY2 "wowcum"
|
|
|
|
#define TAGVAL "wow2"
|
|
|
|
#define TAGVAL2 "wow3rd"
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
IRC_Message* m = uirc_malloc_message("NONE", 0);
|
|
|
|
|
|
|
|
uirc_list_add_tag(m, uirc_malloc_tag(TAGKEY, TAGVAL));
|
|
|
|
uirc_list_add_tag(m, uirc_malloc_tag(TAGKEY2, TAGVAL2));
|
|
|
|
|
|
|
|
IRC_Tag* t = m->tag_list->next->content;
|
|
|
|
if (strcmp(TAGKEY2, t->key) != 0 || strcmp(TAGVAL2, t->value) != 0) {
|
|
|
|
fprintf(stderr, "List allocator didn't allocate things right\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
t = m->tag_list->content;
|
|
|
|
if (strcmp(TAGKEY, t->key) != 0 || strcmp(TAGVAL, t->value) != 0) {
|
|
|
|
fprintf(stderr, "List allocator didn't allocate things right\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uirc_list_remove_tag(m, m->tag_list->content);
|
|
|
|
t = m->tag_list->content;
|
|
|
|
if (strcmp(TAGKEY2, t->key) != 0 || strcmp(TAGVAL2, t->value) != 0) {
|
|
|
|
fprintf(stderr, "List remover fucked up\n");
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
uirc_free_message(m);
|
|
|
|
free(m);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|