Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
f2e83030
Commit
f2e83030
authored
Jan 06, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Add test for shrpx_config
parent
0f89a19f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
101 additions
and
0 deletions
+101
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/shrpx-unittest.cc
src/shrpx-unittest.cc
+3
-0
src/shrpx_config_test.cc
src/shrpx_config_test.cc
+63
-0
src/shrpx_config_test.h
src/shrpx_config_test.h
+34
-0
No files found.
src/Makefile.am
View file @
f2e83030
...
...
@@ -101,6 +101,7 @@ check_PROGRAMS += nghttpx-unittest
nghttpx_unittest_SOURCES
=
shrpx-unittest.cc
\
shrpx_ssl_test.cc shrpx_ssl_test.h
\
shrpx_downstream_test.cc shrpx_downstream_test.h
\
shrpx_config_test.cc shrpx_config_test.h
\
http2_test.cc http2_test.h
\
util_test.cc util_test.h
nghttpx_unittest_CPPFLAGS
=
${AM_CPPFLAGS}
\
...
...
src/shrpx-unittest.cc
View file @
f2e83030
...
...
@@ -30,6 +30,7 @@
/* include test cases' include files here */
#include "shrpx_ssl_test.h"
#include "shrpx_downstream_test.h"
#include "shrpx_config_test.h"
#include "http2_test.h"
#include "util_test.h"
...
...
@@ -102,6 +103,8 @@ int main(int argc, char* argv[])
shrpx
::
test_downstream_assemble_request_cookie
)
||
!
CU_add_test
(
pSuite
,
"downstream_rewrite_norm_location_response_header"
,
shrpx
::
test_downstream_rewrite_norm_location_response_header
)
||
!
CU_add_test
(
pSuite
,
"config_parse_config_str_list"
,
shrpx
::
test_shrpx_config_parse_config_str_list
)
||
!
CU_add_test
(
pSuite
,
"util_streq"
,
shrpx
::
test_util_streq
)
||
!
CU_add_test
(
pSuite
,
"util_inp_strlower"
,
shrpx
::
test_util_inp_strlower
)
||
...
...
src/shrpx_config_test.cc
0 → 100644
View file @
f2e83030
/*
* nghttp2 - HTTP/2.0 C Library
*
* Copyright (c) 2014 Tatsuhiro Tsujikawa
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "shrpx_config_test.h"
#include <CUnit/CUnit.h>
#include "shrpx_config.h"
namespace
shrpx
{
void
test_shrpx_config_parse_config_str_list
(
void
)
{
size_t
outlen
;
auto
res
=
parse_config_str_list
(
&
outlen
,
"a"
);
CU_ASSERT
(
1
==
outlen
);
CU_ASSERT
(
0
==
strcmp
(
"a"
,
res
[
0
]));
res
=
parse_config_str_list
(
&
outlen
,
"a,"
);
CU_ASSERT
(
2
==
outlen
);
CU_ASSERT
(
0
==
strcmp
(
"a"
,
res
[
0
]));
CU_ASSERT
(
0
==
strcmp
(
""
,
res
[
1
]));
res
=
parse_config_str_list
(
&
outlen
,
",a,,"
);
CU_ASSERT
(
4
==
outlen
);
CU_ASSERT
(
0
==
strcmp
(
""
,
res
[
0
]));
CU_ASSERT
(
0
==
strcmp
(
"a"
,
res
[
1
]));
CU_ASSERT
(
0
==
strcmp
(
""
,
res
[
2
]));
CU_ASSERT
(
0
==
strcmp
(
""
,
res
[
3
]));
res
=
parse_config_str_list
(
&
outlen
,
""
);
CU_ASSERT
(
1
==
outlen
);
CU_ASSERT
(
0
==
strcmp
(
""
,
res
[
0
]));
res
=
parse_config_str_list
(
&
outlen
,
"alpha,bravo,charlie"
);
CU_ASSERT
(
3
==
outlen
);
CU_ASSERT
(
0
==
strcmp
(
"alpha"
,
res
[
0
]));
CU_ASSERT
(
0
==
strcmp
(
"bravo"
,
res
[
1
]));
CU_ASSERT
(
0
==
strcmp
(
"charlie"
,
res
[
2
]));
}
}
// namespace shrpx
src/shrpx_config_test.h
0 → 100644
View file @
f2e83030
/*
* nghttp2 - HTTP/2.0 C Library
*
* Copyright (c) 2014 Tatsuhiro Tsujikawa
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef SHRPX_CONFIG_TEST_H
#define SHRPX_CONFIG_TEST_H
namespace
shrpx
{
void
test_shrpx_config_parse_config_str_list
(
void
);
}
// namespace shrpx
#endif
/* SHRPX_CONFIG_TEST_H */
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