1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Feature: Added super basic tests for logmsg module

This commit is contained in:
Philipp Schafft 2019-07-14 10:41:25 +00:00
parent 8b39e8c234
commit fda0ecf0e9
2 changed files with 61 additions and 0 deletions

View File

@ -55,5 +55,19 @@ ctest_reportxml_test_LDADD = libice_ctest.la \
src/reportxml.o src/reportxml.o
check_PROGRAMS += ctest_reportxml.test check_PROGRAMS += ctest_reportxml.test
ctest_logmsg_test_SOURCES = %reldir%/ctest_logmsg.c
ctest_logmsg_test_LDADD = libice_ctest.la \
thread/libicethread.la \
avl/libiceavl.la \
src/private.o \
src/ro.o \
src/io.o \
src/list.o \
src/interface.o \
src/objecthandler.o \
src/filter.o \
src/logmsg.o
check_PROGRAMS += ctest_logmsg.test
# Add all programs to TESTS # Add all programs to TESTS
TESTS = $(check_PROGRAMS) TESTS = $(check_PROGRAMS)

47
src/tests/ctest_logmsg.c Normal file
View File

@ -0,0 +1,47 @@
/* Icecast
*
* This program is distributed under the GNU General Public License, version 2.
* A copy of this license is included with this source.
*
* Copyright 2018, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>,
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include "ctest_lib.h"
#include <igloo/logmsg.h>
static void test_create_unref(void)
{
igloo_logmsg_t *msg;
igloo_objecthandler_t *formater;
igloo_filter_t *filter;
msg = igloo_logmsg_new(NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL__NONE, igloo_LOGMSG_OPT_NONE, NULL, "test");
ctest_test("logmsg created", !igloo_RO_IS_NULL(msg));
ctest_test("un-referenced", igloo_ro_unref(msg) == 0);
formater = igloo_logmsg_formarter(igloo_RO_NULL, NULL, NULL, igloo_RO_NULL);
ctest_test("formater created", !igloo_RO_IS_NULL(formater));
ctest_test("un-referenced", igloo_ro_unref(formater) == 0);
filter = igloo_logmsg_filter(igloo_LOGLEVEL__NONE, igloo_LOGLEVEL__NONE, igloo_LOGMSG_OPT_NONE, igloo_LOGMSG_OPT_NONE, NULL, NULL, NULL, NULL, igloo_RO_NULL);
ctest_test("filter created", !igloo_RO_IS_NULL(filter));
ctest_test("un-referenced", igloo_ro_unref(filter) == 0);
}
int main (void)
{
ctest_init();
test_create_unref();
ctest_fin();
return 0;
}