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

55 lines
1.7 KiB
C

/*
* This file is part of uIRC. (https://git.redxen.eu/caskd/uIRC)
* Copyright (c) 2019-2021 Alex-David Denes
*
* 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"
int
main(void)
{
IRC_Message* m = uirc_struct_assm_message("NONE", false, 0);
m->tag_list = uirc_list_append(NULL, uirc_struct_assm_tag(false, TAGKEY, TAGVAL));
uirc_list_append(m->tag_list, uirc_struct_assm_tag(false, TAGKEY2, NULL));
IRC_Tag* t = m->tag_list->next->content;
if (strcmp(TAGKEY2, t->key) != 0 || t->value != NULL) {
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;
}
print_irc_message(m);
uirc_struct_free(m, IRC_STRUCT_MESSAGE);
free(m);
return EXIT_SUCCESS;
}