Skip to content
Snippets Groups Projects
Commit 6f933e85 authored by Jonathan Schöbel's avatar Jonathan Schöbel
Browse files

added test for Fragment

parent a4dac113
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=15
current_page=16
FILE_NAME_0=839;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fconfigure.ac;0;8
FILE_NAME_1=280;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2FMakefile.am;0;8
FILE_NAME_2=1023;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmain.c;0;8
......@@ -42,10 +42,11 @@ FILE_NAME_9=902;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprg
FILE_NAME_10=0;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flog.h;0;4
FILE_NAME_11=847;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fmacro.h;0;8
FILE_NAME_12=917;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Fsefht.h;0;8
FILE_NAME_13=515;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_13=804;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_14=1253;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8
FILE_NAME_15=3391;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8
FILE_NAME_16=26;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8
FILE_NAME_16=1685;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_fragment.c;0;8
FILE_NAME_17=26;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8
[VTE]
last_dir=/home/jonathan/Dokumente/projekte/prgm/internet/web/SeFHT/tests
......
......@@ -5,6 +5,7 @@ AM_CFLAGS = -Wall -Wextra $(CHECK_CFLAGS)
TESTS =
TESTS += sefht_cms_test
TESTS += sefht_data_test
TESTS += sefht_fragment_test
check_PROGRAMS = $(TESTS)
......@@ -23,3 +24,8 @@ sefht_data_test_SOURCES = test_data.c
sefht_data_test_LDADD =
sefht_data_test_LDADD += $(top_builddir)/src/data.o
sefht_data_test_LDADD += $(LDADD)
sefht_fragment_test_SOURCES = test_fragment.c
sefht_fragment_test_LDADD =
sefht_fragment_test_LDADD += $(top_builddir)/src/fragment.o
sefht_fragment_test_LDADD += $(LDADD)
/*
* test_fragment.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 "error.h"
#include "fragment.h"
START_TEST(test_fragment)
{
struct SH_Error error;
struct SH_Fragment * fragment;
fragment = SH_Fragment_new (NULL);
ck_assert_int_ne ((long int) fragment, (long int) NULL);
SH_Fragment_free (fragment, NULL);
fragment = SH_Fragment_new (&error);
ck_assert_int_ne ((long int) fragment, (long int) NULL);
ck_assert_int_eq (error.type, SUCCESS);
SH_Fragment_free (fragment, &error);
ck_assert_int_eq (error.type, SUCCESS);
}
END_TEST
Suite * fragment_suite (void)
{
Suite *s;
TCase *tc_core;
s = suite_create ("Testsuite SeFHT Fragment");
/* Core test case */
tc_core = tcase_create ("Core");
tcase_add_test (tc_core, test_fragment);
suite_add_tcase (s, tc_core);
return s;
}
int main (int argc, char **argv)
{
int number_failed;
Suite *s;
SRunner *sr;
s = fragment_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;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment