1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-10-27 05:10:16 -04:00

Feature: Added some few tests for report XML

This commit is contained in:
Philipp Schafft 2018-11-09 13:43:40 +00:00
parent aa8b821484
commit 4473ed367f
2 changed files with 55 additions and 0 deletions

View File

@ -47,5 +47,13 @@ ctest_list_test_LDADD = libice_ctest.la \
src/list.o
check_PROGRAMS += ctest_list.test
ctest_reportxml_test_SOURCES = %reldir%/ctest_reportxml.c
ctest_reportxml_test_LDADD = libice_ctest.la \
thread/libicethread.la \
avl/libiceavl.la \
src/ro.o \
src/reportxml.o
check_PROGRAMS += ctest_reportxml.test
# Add all programs to TESTS
TESTS = $(check_PROGRAMS)

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/reportxml.h>
static void test_create_unref(void)
{
igloo_reportxml_t *report;
igloo_reportxml_node_t *node;
igloo_reportxml_database_t *database;
report = igloo_ro_new(igloo_reportxml_t);
ctest_test("report created", !igloo_RO_IS_NULL(report));
ctest_test("un-referenced", igloo_ro_unref(report) == 0);
node = reportxml_node_new(REPORTXML_NODE_TYPE_REPORT, NULL, NULL, NULL);
ctest_test("node created", !igloo_RO_IS_NULL(node));
ctest_test("un-referenced", igloo_ro_unref(node) == 0);
database = igloo_ro_new(igloo_reportxml_database_t);
ctest_test("database created", !igloo_RO_IS_NULL(database));
ctest_test("un-referenced", igloo_ro_unref(database) == 0);
}
int main (void)
{
ctest_init();
test_create_unref();
ctest_fin();
return 0;
}