Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
d8f01c3a
Commit
d8f01c3a
authored
Aug 20, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added apply_al()l test to tests
parent
3af247fb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
daily_dateonly20160820.txt
tests/logs/daily_dateonly20160820.txt
+10
-0
registry.cpp
tests/registry.cpp
+29
-2
No files found.
tests/logs/daily_dateonly20160820.txt
0 → 100644
View file @
d8f01c3a
[2016-08-20 13:50:56.499] [logger] [info] Test message 0
[2016-08-20 13:50:56.499] [logger] [info] Test message 1
[2016-08-20 13:50:56.499] [logger] [info] Test message 2
[2016-08-20 13:50:56.499] [logger] [info] Test message 3
[2016-08-20 13:50:56.499] [logger] [info] Test message 4
[2016-08-20 13:50:56.499] [logger] [info] Test message 5
[2016-08-20 13:50:56.500] [logger] [info] Test message 6
[2016-08-20 13:50:56.500] [logger] [info] Test message 7
[2016-08-20 13:50:56.500] [logger] [info] Test message 8
[2016-08-20 13:50:56.500] [logger] [info] Test message 9
tests/registry.cpp
View file @
d8f01c3a
#include "includes.h"
static
const
char
*
tested_logger_name
=
"null_logger"
;
static
const
char
*
tested_logger_name2
=
"null_logger2"
;
TEST_CASE
(
"register_drop"
,
"[registry]"
)
{
...
...
@@ -22,6 +23,30 @@ TEST_CASE("explicit register" "[registry]")
REQUIRE_THROWS_AS
(
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_logger_name
),
spdlog
::
spdlog_ex
);
}
TEST_CASE
(
"apply_all"
"[registry]"
)
{
spdlog
::
drop_all
();
auto
logger
=
std
::
make_shared
<
spdlog
::
logger
>
(
tested_logger_name
,
std
::
make_shared
<
spdlog
::
sinks
::
null_sink_st
>
());
spdlog
::
register_logger
(
logger
);
auto
logger2
=
std
::
make_shared
<
spdlog
::
logger
>
(
tested_logger_name2
,
std
::
make_shared
<
spdlog
::
sinks
::
null_sink_st
>
());
spdlog
::
register_logger
(
logger2
);
int
counter
=
0
;
spdlog
::
apply_all
([
&
counter
](
std
::
shared_ptr
<
spdlog
::
logger
>
l
){
counter
++
;});
REQUIRE
(
counter
==
2
);
counter
=
0
;
spdlog
::
drop
(
tested_logger_name2
);
spdlog
::
apply_all
([
&
counter
](
std
::
shared_ptr
<
spdlog
::
logger
>
l
)
{
REQUIRE
(
l
->
name
()
==
tested_logger_name
);
counter
++
;
}
);
REQUIRE
(
counter
==
1
);
}
TEST_CASE
(
"drop"
"[registry]"
)
{
spdlog
::
drop_all
();
...
...
@@ -34,10 +59,10 @@ TEST_CASE("drop_all" "[registry]")
{
spdlog
::
drop_all
();
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_logger_name
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
"name2"
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_logger_name2
);
spdlog
::
drop_all
();
REQUIRE_FALSE
(
spdlog
::
get
(
tested_logger_name
));
REQUIRE_FALSE
(
spdlog
::
get
(
"name2"
));
REQUIRE_FALSE
(
spdlog
::
get
(
tested_logger_name
));
}
...
...
@@ -51,3 +76,5 @@ TEST_CASE("drop non existing" "[registry]")
spdlog
::
drop_all
();
}
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