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

TextMark: added tests

parent 0f585173
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=25
current_page=46
FILE_NAME_0=139;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2FREADME;0;8
FILE_NAME_1=134;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2F.gitignore;0;8
FILE_NAME_2=1737;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fconfigure.ac;0;8
......@@ -57,7 +57,7 @@ FILE_NAME_24=1036;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fp
FILE_NAME_25=7040;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext_segment.c;0;8
FILE_NAME_26=1083;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext_segment.h;0;8
FILE_NAME_27=903;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext_mark.c;0;8
FILE_NAME_28=1892;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext_mark_internal.c;0;8
FILE_NAME_28=1156;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Ftext_mark_internal.c;0;8
FILE_NAME_29=24;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.c;0;8
FILE_NAME_30=24;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator.h;0;8
FILE_NAME_31=28;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fvalidator_tag.c;0;8
......@@ -75,10 +75,11 @@ FILE_NAME_42=33;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprg
FILE_NAME_43=4771;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text_fragment.c;0;8
FILE_NAME_44=24;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_attr.c;0;8
FILE_NAME_45=3584;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8
FILE_NAME_46=29;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
FILE_NAME_47=536;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8
FILE_NAME_48=2425;YAML;0;EUTF-8;0;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2F.gitlab-ci.yml;0;4
FILE_NAME_49=354;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fgitlab-ci%2Fupload.sh.in;0;8
FILE_NAME_46=2108;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text_mark.c;0;8
FILE_NAME_47=29;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
FILE_NAME_48=536;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8
FILE_NAME_49=2425;YAML;0;EUTF-8;0;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2F.gitlab-ci.yml;0;4
FILE_NAME_50=354;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fgitlab-ci%2Fupload.sh.in;0;8
[VTE]
last_dir=/home/jonathan/Documents/projects/prgm/internet/web/SeFHT/tests
......
......@@ -73,7 +73,6 @@ text_mark_new (const enum SH_MARK_TYPE type,
mark->next = NULL;
set_success (status);
return mark;
}
......
......@@ -18,6 +18,7 @@ check_PROGRAMS += sefht_fragment_test
check_PROGRAMS += sefht_node_fragment_test
check_PROGRAMS += sefht_text_fragment_test
check_PROGRAMS += sefht_text_test
check_PROGRAMS += sefht_text_mark_test
XFAIL_TESTS =
XFAIL_TESTS += sefht_fragment_test
......@@ -79,3 +80,7 @@ sefht_text_fragment_test_LDADD += $(LDADD)
sefht_text_test_SOURCES = test_text.c
sefht_text_test_LDADD =
sefht_text_test_LDADD += $(LDADD)
sefht_text_mark_test_SOURCES = test_text_mark.c
sefht_text_mark_test_LDADD =
sefht_text_mark_test_LDADD += $(LDADD)
/*
* test_text_mark.c
*
* Copyright 2023 Jonathan Schöbel <jonathan@xn--schbel-yxa.info>
*
* 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 <limits.h>
#include <stdbool.h>
#include <stdlib.h>
#include "log.h"
#include "macro.h"
#include "status.h"
#include "text_mark_internal.c"
START_TEST(test_text_mark_no_status)
{
struct text_mark * mark;
mark = text_mark_new (SH_MARK_TYPE_ABS, 5, NULL);
ck_assert_ptr_ne (NULL, mark);
ck_assert_int_eq (SH_MARK_TYPE_ABS, mark->type);
ck_assert_int_eq (5, mark->offset);
ck_assert_int_eq (0, mark->mark_n);
ck_assert_ptr_ne (NULL, mark->marks);
ck_assert_ptr_eq (NULL, mark->next);
text_mark_free (mark);
}
END_TEST
START_TEST(test_text_mark_with_status)
{
struct SH_Status status;
struct text_mark * mark;
_status_preinit (status);
mark = text_mark_new (SH_MARK_TYPE_ABS, 5, &status);
ck_assert_ptr_ne (NULL, mark);
ck_assert_int_eq (status.status, UNDEFINED);
ck_assert_int_eq (SH_MARK_TYPE_ABS, mark->type);
ck_assert_int_eq (5, mark->offset);
ck_assert_int_eq (0, mark->mark_n);
ck_assert_ptr_ne (NULL, mark->marks);
ck_assert_ptr_eq (NULL, mark->next);
text_mark_free (mark);
}
END_TEST
Suite * test_suite (void)
{
Suite *s;
TCase *tc_core;
s = suite_create ("Testsuite SeFHT Text Mark (internal) ");
/* Core test case */
tc_core = tcase_create ("Core");
tcase_add_test (tc_core, test_text_mark_no_status);
tcase_add_test (tc_core, test_text_mark_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;
}
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