Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
29c57e4e
Unverified
Commit
29c57e4e
authored
Aug 14, 2016
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: add unit tests for lxc_string_in_array()
Signed-off-by:
Christian Brauner
<
cbrauner@suse.de
>
parent
bed0d08f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
Makefile.am
src/lxc/Makefile.am
+2
-1
Makefile.am
src/tests/Makefile.am
+0
-2
lxc-test-utils.c
src/tests/lxc-test-utils.c
+18
-2
No files found.
src/lxc/Makefile.am
View file @
29c57e4e
...
@@ -32,7 +32,8 @@ noinst_HEADERS = \
...
@@ -32,7 +32,8 @@ noinst_HEADERS = \
start.h
\
start.h
\
state.h
\
state.h
\
utils.h
\
utils.h
\
criu.h
criu.h
\
../tests/lxctest.h
if
IS_BIONIC
if
IS_BIONIC
noinst_HEADERS
+=
\
noinst_HEADERS
+=
\
...
...
src/tests/Makefile.am
View file @
29c57e4e
...
@@ -2,8 +2,6 @@ if ENABLE_TESTS
...
@@ -2,8 +2,6 @@ if ENABLE_TESTS
LDADD
=
../lxc/liblxc.so
LDADD
=
../lxc/liblxc.so
noinst_HEADERS
+=
lxctest.h
lxc_test_containertests_SOURCES
=
containertests.c
lxc_test_containertests_SOURCES
=
containertests.c
lxc_test_locktests_SOURCES
=
locktests.c
lxc_test_locktests_SOURCES
=
locktests.c
lxc_test_startone_SOURCES
=
startone.c
lxc_test_startone_SOURCES
=
startone.c
...
...
src/tests/lxc-test-utils.c
View file @
29c57e4e
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
#include "lxctest.h"
#include "lxctest.h"
#include "utils.h"
#include "utils.h"
void
test_string_replace
(
void
)
void
test_
lxc_
string_replace
(
void
)
{
{
char
*
s
;
char
*
s
;
...
@@ -65,9 +65,25 @@ void test_string_replace(void)
...
@@ -65,9 +65,25 @@ void test_string_replace(void)
free
(
s
);
free
(
s
);
}
}
void
test_lxc_string_in_array
(
void
)
{
lxc_test_assert_abort
(
lxc_string_in_array
(
""
,
(
const
char
*
[]){
""
,
NULL
}));
lxc_test_assert_abort
(
!
lxc_string_in_array
(
"A"
,
(
const
char
*
[]){
""
,
NULL
}));
lxc_test_assert_abort
(
!
lxc_string_in_array
(
"AAA"
,
(
const
char
*
[]){
""
,
"3472"
,
"jshH"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"A"
,
(
const
char
*
[]){
"A"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"A"
,
(
const
char
*
[]){
"A"
,
"B"
,
"C"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"A"
,
(
const
char
*
[]){
"B"
,
"A"
,
"C"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"ABC"
,
(
const
char
*
[]){
"ASD"
,
"ATR"
,
"ABC"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"GHJ"
,
(
const
char
*
[]){
"AZIU"
,
"WRT567B"
,
"879C"
,
"GHJ"
,
"IUZ89"
,
NULL
}));
lxc_test_assert_abort
(
lxc_string_in_array
(
"XYZ"
,
(
const
char
*
[]){
"BERTA"
,
"ARQWE(9"
,
"C8Zhkd"
,
"7U"
,
"XYZ"
,
"UOIZ9"
,
"=)()"
,
NULL
}));
}
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
test_string_replace
();
test_lxc_string_replace
();
test_lxc_string_in_array
();
exit
(
EXIT_SUCCESS
);
exit
(
EXIT_SUCCESS
);
}
}
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