Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SeFHT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
josc941e
SeFHT
Commits
e8deb8ce
Commit
e8deb8ce
authored
1 year ago
by
Jonathan Schöbel
Browse files
Options
Downloads
Patches
Plain Diff
NodeFragment: added tests for get_attr method.
added tests for getter
parent
51a3ab66
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sefht.geany
+3
-3
3 additions, 3 deletions
sefht.geany
tests/Makefile.am
+1
-0
1 addition, 0 deletions
tests/Makefile.am
tests/test_node_fragment.c
+85
-0
85 additions, 0 deletions
tests/test_node_fragment.c
with
89 additions
and
3 deletions
sefht.geany
+
3
−
3
View file @
e8deb8ce
...
...
@@ -28,7 +28,7 @@ long_line_behaviour=1
long_line_column=72
[files]
current_page=1
6
current_page=
3
1
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
...
...
@@ -57,10 +57,10 @@ FILE_NAME_24=4735;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fp
FILE_NAME_25=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_26=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_27=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_28=
533
;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_28=
1044
;Make;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2FMakefile.am;0;8
FILE_NAME_29=1085;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_cms.c;0;8
FILE_NAME_30=3283;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_data.c;0;8
FILE_NAME_31=
53309
;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8
FILE_NAME_31=
12038
;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_node_fragment.c;0;8
FILE_NAME_32=15195;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_attr.c;0;8
FILE_NAME_33=11068;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_text.c;0;8
FILE_NAME_34=5744;C;0;EUTF-8;1;1;0;%2Fhome%2Fjonathan%2FDokumente%2Fprojekte%2Fprgm%2Finternet%2Fweb%2FSeFHT%2Ftests%2Ftest_validator.c;0;8
...
...
This diff is collapsed.
Click to expand it.
tests/Makefile.am
+
1
−
0
View file @
e8deb8ce
...
...
@@ -36,6 +36,7 @@ sefht_data_test_LDADD += $(LDADD)
sefht_node_fragment_test_SOURCES
=
test_node_fragment.c
sefht_node_fragment_test_LDADD
=
sefht_node_fragment_test_LDADD
+=
$(
OBJECT_PREFIX
)
attr.o
sefht_node_fragment_test_LDADD
+=
$(
OBJECT_PREFIX
)
data.o
sefht_node_fragment_test_LDADD
+=
$(
OBJECT_PREFIX
)
fragment.o
sefht_node_fragment_test_LDADD
+=
$(
OBJECT_PREFIX
)
text.o
...
...
This diff is collapsed.
Click to expand it.
tests/test_node_fragment.c
+
85
−
0
View file @
e8deb8ce
...
...
@@ -436,6 +436,89 @@ START_TEST(test_node_fragment_attr_alloc)
}
END_TEST
START_TEST
(
test_node_fragment_attr_get_no_status
)
{
SH_Attr
*
attr1
;
const
SH_Attr
*
attr2
;
SH_Data
*
data
;
SH_NodeFragment
*
fragment
;
bool
result
;
/* setup */
attr1
=
SH_Attr_new
(
"name"
,
"value"
,
NULL
);
ck_assert_ptr_ne
(
NULL
,
attr1
);
data
=
SH_Data_new
(
NULL
);
ck_assert_ptr_ne
(
NULL
,
data
);
fragment
=
(
SH_NodeFragment
*
)
SH_NodeFragment_new
(
"html"
,
data
,
NULL
);
ck_assert_ptr_ne
(
NULL
,
fragment
);
result
=
SH_NodeFragment_append_attr_copy
(
fragment
,
attr1
,
NULL
);
ck_assert_int_eq
(
TRUE
,
result
);
/* test - success */
attr2
=
SH_NodeFragment_get_attr
(
fragment
,
0
,
NULL
);
ck_assert_ptr_ne
(
NULL
,
attr2
);
ck_assert
(
Attr_is_equal
(
attr1
,
attr2
));
/* test - fail */
attr2
=
SH_NodeFragment_get_attr
(
fragment
,
1
,
NULL
);
ck_assert_ptr_eq
(
NULL
,
attr2
);
/* cleanup */
SH_NodeFragment_free
(
fragment
);
SH_Data_free
(
data
);
SH_Attr_free
(
attr1
);
}
END_TEST
START_TEST
(
test_node_fragment_attr_get_with_status
)
{
struct
SH_Status
status
;
SH_Attr
*
attr1
;
const
SH_Attr
*
attr2
;
SH_Data
*
data
;
SH_NodeFragment
*
fragment
;
bool
result
;
/* setup */
attr1
=
SH_Attr_new
(
"name"
,
"value"
,
NULL
);
ck_assert_ptr_ne
(
NULL
,
attr1
);
data
=
SH_Data_new
(
NULL
);
ck_assert_ptr_ne
(
NULL
,
data
);
fragment
=
(
SH_NodeFragment
*
)
SH_NodeFragment_new
(
"html"
,
data
,
NULL
);
ck_assert_ptr_ne
(
NULL
,
fragment
);
result
=
SH_NodeFragment_append_attr_copy
(
fragment
,
attr1
,
NULL
);
ck_assert_int_eq
(
TRUE
,
result
);
/* test - success */
_status_preinit
(
status
);
attr2
=
SH_NodeFragment_get_attr
(
fragment
,
0
,
&
status
);
ck_assert_ptr_ne
(
NULL
,
attr2
);
ck_assert_int_eq
(
SUCCESS
,
status
.
status
);
ck_assert
(
Attr_is_equal
(
attr1
,
attr2
));
/* test - fail */
_status_preinit
(
status
);
attr2
=
SH_NodeFragment_get_attr
(
fragment
,
1
,
&
status
);
ck_assert_ptr_eq
(
NULL
,
attr2
);
ck_assert_int_eq
(
E_VALUE
,
status
.
status
);
/* cleanup */
SH_NodeFragment_free
(
fragment
);
SH_Data_free
(
data
);
SH_Attr_free
(
attr1
);
}
END_TEST
START_TEST
(
test_node_fragment_child_alloc
)
{
#define alloc_size get_child_alloc_size
...
...
@@ -1828,6 +1911,8 @@ Suite * fragment_suite (void)
tcase_add_test
(
tc_core
,
test_node_fragment_tag_with_status
);
tcase_add_test
(
tc_core
,
test_node_fragment_tag_raw
);
tcase_add_test
(
tc_core
,
test_node_fragment_attr_alloc
);
tcase_add_test
(
tc_core
,
test_node_fragment_attr_get_no_status
);
tcase_add_test
(
tc_core
,
test_node_fragment_attr_get_with_status
);
tcase_add_test
(
tc_core
,
test_node_fragment_child_alloc
);
tcase_add_test
(
tc_core
,
test_node_fragment_child
);
tcase_add_test
(
tc_core
,
test_node_fragment_get_child
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment