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
01601cef
Commit
01601cef
authored
Jul 15, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed tests warnings
parent
f5bde237
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
22 deletions
+32
-22
.gitignore
.gitignore
+3
-2
example.vcxproj
example/example.vcxproj
+3
-4
file_helper.cpp
tests/file_helper.cpp
+2
-2
daily_dateonly20160715.txt
tests/logs/daily_dateonly20160715.txt
+10
-0
registry.cpp
tests/registry.cpp
+14
-14
No files found.
.gitignore
View file @
01601cef
...
...
@@ -55,4 +55,6 @@ CMakeFiles
CMakeScripts
Makefile
cmake_install.cmake
install_manifest.txt
\ No newline at end of file
install_manifest.txt
/tests/tests.VC.VC.opendb
/tests/tests.VC.db
example/example.vcxproj
View file @
01601cef
...
...
@@ -11,10 +11,9 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<
ClCompile
Include=
"..\include\spdlog\details
\format.cc"
>
<
None
Include=
"..\include\spdlog\fmt
\format.cc"
>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
true
</ExcludedFromBuild>
<ExcludedFromBuild
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
true
</ExcludedFromBuild>
</ClCompile>
</None>
<ClCompile
Include=
"example.cpp"
/>
</ItemGroup>
<ItemGroup>
...
...
@@ -23,7 +22,6 @@
<ClInclude
Include=
"..\include\spdlog\details\async_logger_impl.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\async_log_helper.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\file_helper.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\format.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\logger_impl.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\log_msg.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\mpmc_bounded_q.h"
/>
...
...
@@ -32,6 +30,7 @@
<ClInclude
Include=
"..\include\spdlog\details\pattern_formatter_impl.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\registry.h"
/>
<ClInclude
Include=
"..\include\spdlog\details\spdlog_impl.h"
/>
<ClInclude
Include=
"..\include\spdlog\fmt\format.h"
/>
<ClInclude
Include=
"..\include\spdlog\formatter.h"
/>
<ClInclude
Include=
"..\include\spdlog\logger.h"
/>
<ClInclude
Include=
"..\include\spdlog\sinks\android_sink.h"
/>
...
...
tests/file_helper.cpp
View file @
01601cef
...
...
@@ -29,12 +29,12 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
TEST_CASE
(
"file_helper_size"
,
"[file_helper::size()]]"
)
{
prepare_logdir
();
auto
expected_size
=
123
;
size_t
expected_size
=
123
;
{
file_helper
helper
(
true
);
helper
.
open
(
target_filename
);
write_with_helper
(
helper
,
expected_size
);
REQUIRE
(
helper
.
size
(
)
==
expected_size
);
REQUIRE
(
static_cast
<
size_t
>
(
helper
.
size
()
)
==
expected_size
);
}
REQUIRE
(
get_filesize
(
target_filename
)
==
expected_size
);
}
...
...
tests/logs/daily_dateonly20160715.txt
0 → 100644
View file @
01601cef
[2016-07-15 18:30:57.643] [logger] [info] Test message 0
[2016-07-15 18:30:57.643] [logger] [info] Test message 1
[2016-07-15 18:30:57.643] [logger] [info] Test message 2
[2016-07-15 18:30:57.643] [logger] [info] Test message 3
[2016-07-15 18:30:57.643] [logger] [info] Test message 4
[2016-07-15 18:30:57.643] [logger] [info] Test message 5
[2016-07-15 18:30:57.643] [logger] [info] Test message 6
[2016-07-15 18:30:57.643] [logger] [info] Test message 7
[2016-07-15 18:30:57.643] [logger] [info] Test message 8
[2016-07-15 18:30:57.643] [logger] [info] Test message 9
tests/registry.cpp
View file @
01601cef
#include "includes.h"
static
const
char
*
logger_name
=
"null_logger"
;
static
const
char
*
tested_
logger_name
=
"null_logger"
;
TEST_CASE
(
"register_drop"
,
"[registry]"
)
{
spdlog
::
drop_all
();
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
);
REQUIRE
(
spdlog
::
get
(
logger_name
)
!=
nullptr
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
);
REQUIRE
(
spdlog
::
get
(
tested_
logger_name
)
!=
nullptr
);
//Throw if registring existing name
REQUIRE_THROWS_AS
(
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
),
spdlog
::
spdlog_ex
);
REQUIRE_THROWS_AS
(
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
),
spdlog
::
spdlog_ex
);
}
TEST_CASE
(
"explicit register"
"[registry]"
)
{
spdlog
::
drop_all
();
auto
logger
=
std
::
make_shared
<
spdlog
::
logger
>
(
logger_name
,
std
::
make_shared
<
spdlog
::
sinks
::
null_sink_st
>
());
auto
logger
=
std
::
make_shared
<
spdlog
::
logger
>
(
tested_
logger_name
,
std
::
make_shared
<
spdlog
::
sinks
::
null_sink_st
>
());
spdlog
::
register_logger
(
logger
);
REQUIRE
(
spdlog
::
get
(
logger_name
)
!=
nullptr
);
REQUIRE
(
spdlog
::
get
(
tested_
logger_name
)
!=
nullptr
);
//Throw if registring existing name
REQUIRE_THROWS_AS
(
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
),
spdlog
::
spdlog_ex
);
REQUIRE_THROWS_AS
(
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
),
spdlog
::
spdlog_ex
);
}
TEST_CASE
(
"drop"
"[registry]"
)
{
spdlog
::
drop_all
();
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
);
spdlog
::
drop
(
logger_name
);
REQUIRE_FALSE
(
spdlog
::
get
(
logger_name
));
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
);
spdlog
::
drop
(
tested_
logger_name
);
REQUIRE_FALSE
(
spdlog
::
get
(
tested_
logger_name
));
}
TEST_CASE
(
"drop_all"
"[registry]"
)
{
spdlog
::
drop_all
();
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
"name2"
);
spdlog
::
drop_all
();
REQUIRE_FALSE
(
spdlog
::
get
(
logger_name
));
REQUIRE_FALSE
(
spdlog
::
get
(
tested_
logger_name
));
REQUIRE_FALSE
(
spdlog
::
get
(
"name2"
));
}
...
...
@@ -44,10 +44,10 @@ TEST_CASE("drop_all" "[registry]")
TEST_CASE
(
"drop non existing"
"[registry]"
)
{
spdlog
::
drop_all
();
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
logger_name
);
spdlog
::
create
<
spdlog
::
sinks
::
null_sink_mt
>
(
tested_
logger_name
);
spdlog
::
drop
(
"some_name"
);
REQUIRE_FALSE
(
spdlog
::
get
(
"some_name"
));
REQUIRE
(
spdlog
::
get
(
logger_name
));
REQUIRE
(
spdlog
::
get
(
tested_
logger_name
));
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