From a0bb5928af3508716c7dd5d75de78b7268f64f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Sch=C3=B6bel?= <jonathan@xn--schbel-yxa.info> Date: Fri, 17 Mar 2023 16:25:34 +0100 Subject: [PATCH] added Attr The structure SH_Attr implements an HTML Attribute. --- sefht.geany | 41 +++++++------ src/lib/Makefile.am | 2 + src/lib/sefht/attr.c | 101 +++++++++++++++++++++++++++++++ src/lib/sefht/attr.h | 55 +++++++++++++++++ tests/Makefile.am | 5 ++ tests/test_attr.c | 137 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 322 insertions(+), 19 deletions(-) create mode 100644 src/lib/sefht/attr.c create mode 100644 src/lib/sefht/attr.h create mode 100644 tests/test_attr.c diff --git a/sefht.geany b/sefht.geany index 3fcaeb6..beda1b9 100644 --- a/sefht.geany +++ b/sefht.geany @@ -28,11 +28,11 @@ long_line_behaviour=1 long_line_column=72 [files] -current_page=27 +current_page=30 FILE_NAME_0=923;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fconfigure.ac;0;8 FILE_NAME_1=73;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2FMakefile.am;0;8 FILE_NAME_2=1143;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmain.c;0;8 -FILE_NAME_3=1260;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2FMakefile.am;0;8 +FILE_NAME_3=1020;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2FMakefile.am;0;8 FILE_NAME_4=1593;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fcms.c;0;8 FILE_NAME_5=901;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fcms.h;0;8 FILE_NAME_6=2921;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fdata.c;0;8 @@ -43,23 +43,26 @@ FILE_NAME_10=2022;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fp FILE_NAME_11=2558;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ffragment_class.c;0;8 FILE_NAME_12=2167;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fnode_fragment.c;0;8 FILE_NAME_13=5930;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fnode_fragment.h;0;8 -FILE_NAME_14=25820;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext.c;0;8 -FILE_NAME_15=904;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext.h;0;8 -FILE_NAME_16=1779;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.c;0;8 -FILE_NAME_17=919;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.h;0;8 -FILE_NAME_18=14237;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator_tag.c;0;8 -FILE_NAME_19=859;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator_tag.h;0;8 -FILE_NAME_20=4735;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fstatus.h;0;8 -FILE_NAME_21=901;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Flog.h;0;4 -FILE_NAME_22=907;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fmacro.h;0;8 -FILE_NAME_23=1078;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fsefht.h;0;8 -FILE_NAME_24=290;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8 -FILE_NAME_25=1085;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8 -FILE_NAME_26=3283;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8 -FILE_NAME_27=8770;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8 -FILE_NAME_28=11068;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8 -FILE_NAME_29=5744;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8 -FILE_NAME_30=165;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8 +FILE_NAME_14=993;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fattr.c;0;8 +FILE_NAME_15=1225;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fattr.h;0;8 +FILE_NAME_16=25820;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext.c;0;8 +FILE_NAME_17=904;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext.h;0;8 +FILE_NAME_18=1779;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.c;0;8 +FILE_NAME_19=919;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.h;0;8 +FILE_NAME_20=14237;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator_tag.c;0;8 +FILE_NAME_21=859;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator_tag.h;0;8 +FILE_NAME_22=4735;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fstatus.h;0;8 +FILE_NAME_23=901;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Flog.h;0;4 +FILE_NAME_24=907;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fmacro.h;0;8 +FILE_NAME_25=1078;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fsefht.h;0;8 +FILE_NAME_26=533;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8 +FILE_NAME_27=1085;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8 +FILE_NAME_28=3283;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8 +FILE_NAME_29=8770;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8 +FILE_NAME_30=1768;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_attr.c;0;8 +FILE_NAME_31=11068;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8 +FILE_NAME_32=5744;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8 +FILE_NAME_33=165;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8 [VTE] last_dir=/home/jonathan/Documents/projects/prgm/internet/web/SeFHT/tests diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 38a43da..50af8a5 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -9,6 +9,7 @@ libsefht_la_SOURCES += sefht/sefht.h libsefht_la_SOURCES += sefht/macro.h libsefht_la_SOURCES += sefht/log.h libsefht_la_SOURCES += sefht/status.h +libsefht_la_SOURCES += sefht/attr.c sefht/attr.h libsefht_la_SOURCES += sefht/cms.c sefht/cms.h libsefht_la_SOURCES += sefht/data.c sefht/data.h libsefht_la_SOURCES += sefht/fragment.c sefht/fragment.h @@ -26,6 +27,7 @@ nobase_include_HEADERS += sefht/sefht.h nobase_include_HEADERS += sefht/macro.h nobase_include_HEADERS += sefht/log.h nobase_include_HEADERS += sefht/status.h +nobase_include_HEADERS += sefht/attr.h nobase_include_HEADERS += sefht/cms.h nobase_include_HEADERS += sefht/data.h nobase_include_HEADERS += sefht/fragment.h diff --git a/src/lib/sefht/attr.c b/src/lib/sefht/attr.c new file mode 100644 index 0000000..5608b6d --- /dev/null +++ b/src/lib/sefht/attr.c @@ -0,0 +1,101 @@ +/* + * attr.c + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#include <stdlib.h> + +#include "macro.h" +#include "log.h" +#include "status.h" + +#include "attr.h" + + +struct SH_Attr +{ + /*@only@*/ char * name; + /*@null@*/ /*@only@*/ char * value; +}; + + +/*@null@*/ +/*@only@*/ +struct SH_Attr * +SH_Attr_new (const char * name, + /*@null@*/ const char * value, + /*@null@*/ /*@out@*/ struct SH_Status * status) + /*@globals fileSystem@*/ + /*@modifies fileSystem@*/ + /*@modifies status@*/ +{ + struct SH_Attr * attr; + attr = malloc (sizeof (struct SH_Attr)); + + if (attr == NULL) + { + set_status (status, E_ALLOC, 4, "malloc failed"); + return NULL; + } + + attr->name = strdup (name); + if (NULL == attr->name) + { + set_status (status, E_ALLOC, 2, "strdup failed"); + free (attr); + return NULL; + } + + if (NULL == value) + { + attr->value = NULL; + } + else + { + attr->value = strdup (value); + if (NULL == attr->value) + { + set_status (status, E_ALLOC, 2, + "strdup failed"); + free (attr->name); + free (attr); + return NULL; + } + } + + set_success (status); + return attr; +} + +void +SH_Attr_free (/*@only@*/ struct SH_Attr * attr) + /*@modifies attr->name@*/ + /*@modifies attr->value@*/ + /*@modifies attr@*/ + /*@releases attr@*/ +{ + free (attr->name); + if (NULL != attr->value) free (attr->value); + free (attr); + + return; +} diff --git a/src/lib/sefht/attr.h b/src/lib/sefht/attr.h new file mode 100644 index 0000000..e49eca3 --- /dev/null +++ b/src/lib/sefht/attr.h @@ -0,0 +1,55 @@ +/* + * attr.h + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#ifndef SEFHT_ATTR_H +#define SEFHT_ATTR_H + +#if !defined (SEFHT_SEFHT_H_INSIDE) && !defined (SEFHT_COMPILATION) +#error "Only <sefht/sefht.h> can be included directly." +#endif + +#include "status.h" + +#include "data.h" + + +typedef /*@abstract@*/ struct SH_Attr SH_Attr; + + +/*@null@*/ +/*@only@*/ +struct SH_Attr * +SH_Attr_new (const char * name, + /*@null@*/ const char * value, + /*@null@*/ /*@out@*/ struct SH_Status * status) + /*@globals fileSystem@*/ + /*@modifies fileSystem@*/ + /*@modifies status@*/; + +void +SH_Attr_free (/*@only@*/ SH_Attr * attr) + /*@modifies attr@*/ + /*@releases attr@*/; + +#endif /* SEFHT_ATTR_H */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 3053a22..03ed097 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,6 +3,7 @@ AM_CFLAGS = -Wall -Wextra -Wno-nonnull $(CHECK_CFLAGS) TESTS = +TESTS += sefht_attr_test TESTS += sefht_cms_test TESTS += sefht_data_test TESTS += sefht_node_fragment_test @@ -18,6 +19,10 @@ LDADD = $(CHECK_LIBS) OBJECT_PREFIX = $(top_builddir)/src/lib/sefht/libsefht_la- +sefht_attr_test_SOURCES = test_attr.c +sefht_attr_test_LDADD = +sefht_attr_test_LDADD += $(LDADD) + sefht_cms_test_SOURCES = test_cms.c sefht_cms_test_LDADD = sefht_cms_test_LDADD += $(OBJECT_PREFIX)data.o diff --git a/tests/test_attr.c b/tests/test_attr.c new file mode 100644 index 0000000..abdd83f --- /dev/null +++ b/tests/test_attr.c @@ -0,0 +1,137 @@ +/* + * test_attr.c + * + * Copyright 2022 Jonathan Schöbel <jonathan@Ubermos-2019> + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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 this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * + */ + + +#include <check.h> +#include <stdlib.h> + +#include "status.h" + +#include "attr.c" + + +START_TEST(test_attr1_no_status) +{ + struct SH_Attr * attr; + const char * name = "name"; + + attr = SH_Attr_new (name, NULL, NULL); + ck_assert_ptr_ne (NULL, attr); + ck_assert_ptr_ne (name, attr->name); + ck_assert_str_eq (name, attr->name); + ck_assert_ptr_eq (NULL, attr->value); + + SH_Attr_free (attr); +} +END_TEST + +START_TEST(test_attr1_with_status) +{ + struct SH_Status status; + struct SH_Attr * attr; + const char * name = "name"; + + _status_preinit (status); + attr = SH_Attr_new (name, NULL, &status); + ck_assert_ptr_ne (NULL, attr); + ck_assert (succeed (&status)); + ck_assert_ptr_ne (name, attr->name); + ck_assert_str_eq (name, attr->name); + ck_assert_ptr_eq (NULL, attr->value); + + SH_Attr_free (attr); +} +END_TEST + +START_TEST(test_attr2_no_status) +{ + struct SH_Attr * attr; + const char * name = "name"; + const char * value = "value"; + + attr = SH_Attr_new (name, value, NULL); + ck_assert_ptr_ne (NULL, attr); + ck_assert_ptr_ne (name, attr->name); + ck_assert_str_eq (name, attr->name); + ck_assert_ptr_ne (value, attr->value); + ck_assert_str_eq (value, attr->value); + + SH_Attr_free (attr); +} +END_TEST + +START_TEST(test_attr2_with_status) +{ + struct SH_Status status; + struct SH_Attr * attr; + const char * name = "name"; + const char * value = "value"; + + _status_preinit (status); + attr = SH_Attr_new (name, value, &status); + ck_assert_ptr_ne (NULL, attr); + ck_assert (succeed (&status)); + ck_assert_ptr_ne (name, attr->name); + ck_assert_str_eq (name, attr->name); + ck_assert_ptr_ne (value, attr->value); + ck_assert_str_eq (value, attr->value); + + SH_Attr_free (attr); +} +END_TEST + +Suite * test_suite (void) +{ + Suite *s; + TCase *tc_core; + + s = suite_create ("Testsuite SeFHT Attr"); + + /* Core test case */ + tc_core = tcase_create ("Core"); + + tcase_add_test (tc_core, test_attr1_no_status); + tcase_add_test (tc_core, test_attr1_with_status); + tcase_add_test (tc_core, test_attr2_no_status); + tcase_add_test (tc_core, test_attr2_with_status); + suite_add_tcase (s, tc_core); + + return s; +} + +int main (void) +{ + int number_failed; + Suite *s; + SRunner *sr; + + s = test_suite (); + sr = srunner_create (s); + + srunner_run_all (sr, CK_NORMAL); + number_failed = srunner_ntests_failed (sr); + srunner_free (sr); + + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; +} + -- GitLab