Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
spr0cketeer
Icecast-Server
Commits
69aff060
Commit
69aff060
authored
Aug 01, 2018
by
Philipp Schafft
🦁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature: Added more tests regarding refobject sizes
parent
f82df09d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
tests/ctest_refobject.c
tests/ctest_refobject.c
+29
-0
No files found.
tests/ctest_refobject.c
View file @
69aff060
...
...
@@ -39,6 +39,33 @@ static void test_create_ref_unref(void)
ctest_test
(
"un-referenced (2 of 2)"
,
refobject_unref
(
a
)
==
0
);
}
static
void
test_sizes
(
void
)
{
refobject_t
a
;
a
=
refobject_new
(
sizeof
(
refobject_base_t
)
+
1024
,
NULL
,
NULL
,
NULL
,
REFOBJECT_NULL
);
ctest_test
(
"refobject created with size=sizeof(refobject_base_t) + 1024"
,
!
REFOBJECT_IS_NULL
(
a
));
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
a
=
refobject_new
(
sizeof
(
refobject_base_t
)
+
131072
,
NULL
,
NULL
,
NULL
,
REFOBJECT_NULL
);
ctest_test
(
"refobject created with size=sizeof(refobject_base_t) + 131072"
,
!
REFOBJECT_IS_NULL
(
a
));
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
if
(
sizeof
(
refobject_base_t
)
>=
1
)
{
a
=
refobject_new
(
sizeof
(
refobject_base_t
)
-
1
,
NULL
,
NULL
,
NULL
,
REFOBJECT_NULL
);
ctest_test
(
"refobject created with size=sizeof(refobject_base_t) - 1"
,
REFOBJECT_IS_NULL
(
a
));
if
(
!
REFOBJECT_IS_NULL
(
a
))
{
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
}
}
a
=
refobject_new
(
0
,
NULL
,
NULL
,
NULL
,
REFOBJECT_NULL
);
ctest_test
(
"refobject created with size=0"
,
REFOBJECT_IS_NULL
(
a
));
if
(
!
REFOBJECT_IS_NULL
(
a
))
{
ctest_test
(
"un-referenced"
,
refobject_unref
(
a
)
==
0
);
}
}
static
void
test_name
(
void
)
{
refobject_t
a
;
...
...
@@ -138,6 +165,8 @@ int main (void)
test_create_ref_unref
();
test_sizes
();
test_name
();
test_userdata
();
test_associated
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment