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

Validator: added copy tests

parent 3b1a1807
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=42
current_page=53
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
......@@ -71,7 +71,7 @@ FILE_NAME_38=924;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fpr
FILE_NAME_39=18;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Flog.h;0;4
FILE_NAME_40=20;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fmacro.h;0;8
FILE_NAME_41=20;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fsrc%2Flib%2Fsefht%2Fsefht.h;0;8
FILE_NAME_42=702;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_42=3077;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_43=218;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Fno_test.sh.in;0;8
FILE_NAME_44=23;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8
FILE_NAME_45=24;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8
......@@ -81,8 +81,8 @@ FILE_NAME_48=5714;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fp
FILE_NAME_49=24;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_attr.c;0;8
FILE_NAME_50=4221;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8
FILE_NAME_51=994;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text_mark.c;0;8
FILE_NAME_52=2177;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
FILE_NAME_53=10866;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator_tag.c;0;8
FILE_NAME_52=2447;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
FILE_NAME_53=3880;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator_tag.c;0;8
FILE_NAME_54=536;None;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftodo.txt;0;8
FILE_NAME_55=201;YAML;0;EUTF-8;0;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2F.gitlab-ci.yml;0;4
FILE_NAME_56=71;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Fgitlab-ci%2Fupload.sh.in;0;8
......
......@@ -66,6 +66,47 @@ START_TEST(test_validator_with_status)
}
END_TEST
START_TEST(test_validator_copy_no_status)
{
struct SH_Validator * validator;
struct SH_Validator * copy;
/* setup */
validator = SH_Validator_new (NULL);
ck_assert_ptr_ne (NULL, validator);
/* test */
copy = SH_Validator_copy (validator, NULL);
ck_assert_ptr_ne (NULL, copy);
/* cleanup */
SH_Validator_free (copy);
SH_Validator_free (validator);
}
END_TEST
START_TEST(test_validator_copy_with_status)
{
struct SH_Status status;
struct SH_Validator * validator;
struct SH_Validator * copy;
/* setup */
validator = SH_Validator_new (NULL);
ck_assert_ptr_ne (NULL, validator);
/* test */
_status_preinit (status);
copy = SH_Validator_copy (validator, &status);
ck_assert_ptr_ne (NULL, copy);
ck_assert_int_eq (SUCCESS, status.status);
/* cleanup */
SH_Validator_free (copy);
SH_Validator_free (validator);
}
END_TEST
START_TEST(test_validator_spec_no_status)
{
struct SH_Validator * validator;
......@@ -107,6 +148,8 @@ Suite * validator_suite (void)
tcase_add_test (tc_core, test_validator_no_status);
tcase_add_test (tc_core, test_validator_with_status);
tcase_add_test (tc_core, test_validator_copy_no_status);
tcase_add_test (tc_core, test_validator_copy_with_status);
tcase_add_test (tc_core, test_validator_spec_no_status);
tcase_add_test (tc_core, test_validator_spec_with_status);
suite_add_tcase (s, tc_core);
......
......@@ -82,6 +82,75 @@ START_TEST(test_validator_with_status)
}
END_TEST
START_TEST(test_validator_copy_no_status)
{
struct SH_Validator * validator;
struct SH_Validator * copy;
/* setup */
validator = SH_Validator_new_html5 (NULL);
ck_assert_ptr_ne (NULL, validator);
/* test */
copy = SH_Validator_copy (validator, NULL);
ck_assert_ptr_ne (NULL, copy);
ck_assert_ptr_ne (NULL, copy->tags);
ck_assert_ptr_ne (validator->tags, copy->tags);
ck_assert_int_eq (validator->tag_n, copy->tag_n);
ck_assert_int_eq (validator->last_tag, copy->last_tag);
for (size_t index = 0; index < copy->tag_n; index++)
{
ck_assert_int_eq (validator->tags[index].id,
copy->tags[index].id);
ck_assert_ptr_ne (validator->tags[index].name,
copy->tags[index].name);
ck_assert_str_eq (validator->tags[index].name,
copy->tags[index].name);
}
SH_Validator_free (copy);
SH_Validator_free (validator);
}
END_TEST
START_TEST(test_validator_copy_with_status)
{
struct SH_Status status;
struct SH_Validator * validator;
struct SH_Validator * copy;
/* setup */
validator = SH_Validator_new_html5 (NULL);
ck_assert_ptr_ne (NULL, validator);
/* test */
_status_preinit (status);
copy = SH_Validator_copy (validator, &status);
ck_assert_ptr_ne (NULL, copy);
ck_assert_int_eq (status.status, SUCCESS);
ck_assert_ptr_ne (NULL, copy->tags);
ck_assert_ptr_ne (validator->tags, copy->tags);
ck_assert_int_eq (validator->tag_n, copy->tag_n);
ck_assert_int_eq (validator->last_tag, copy->last_tag);
for (size_t index = 0; index < copy->tag_n; index++)
{
ck_assert_int_eq (validator->tags[index].id,
copy->tags[index].id);
ck_assert_ptr_ne (validator->tags[index].name,
copy->tags[index].name);
ck_assert_str_eq (validator->tags[index].name,
copy->tags[index].name);
}
SH_Validator_free (copy);
SH_Validator_free (validator);
}
END_TEST
START_TEST(test_validator_spec_no_status)
{
struct SH_Validator * validator;
......@@ -393,6 +462,8 @@ Suite * test_suite (void)
tcase_add_test (tc_core, test_validator_no_status);
tcase_add_test (tc_core, test_validator_with_status);
tcase_add_test (tc_core, test_validator_copy_no_status);
tcase_add_test (tc_core, test_validator_copy_with_status);
tcase_add_test (tc_core, test_validator_spec_no_status);
tcase_add_test (tc_core, test_validator_spec_with_status);
tcase_add_test (tc_core, test_validator_tag_register_no_status);
......
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