Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
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
spdlog
Commits
dace0993
Commit
dace0993
authored
Sep 28, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added fmt_helper tests
parent
0876e39c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
tests/CMakeLists.txt
tests/CMakeLists.txt
+1
-1
tests/test_fmt_helper.cpp
tests/test_fmt_helper.cpp
+57
-0
No files found.
tests/CMakeLists.txt
View file @
dace0993
...
...
@@ -17,7 +17,7 @@ set(SPDLOG_UTESTS_SOURCES
main.cpp
test_mpmc_q.cpp
test_sink.h
)
test_fmt_helper.cpp
)
add_executable
(
${
PROJECT_NAME
}
${
SPDLOG_UTESTS_SOURCES
}
)
target_link_libraries
(
${
PROJECT_NAME
}
PRIVATE Threads::Threads
)
...
...
tests/test_fmt_helper.cpp
0 → 100644
View file @
dace0993
#include "includes.h"
void
test_pad2
(
int
n
,
const
char
*
expected
)
{
fmt
::
memory_buffer
buf
;
spdlog
::
details
::
fmt_helper
::
pad2
(
n
,
buf
);
REQUIRE
(
fmt
::
to_string
(
buf
)
==
expected
);
}
void
test_pad3
(
int
n
,
const
char
*
expected
)
{
fmt
::
memory_buffer
buf
;
spdlog
::
details
::
fmt_helper
::
pad3
(
n
,
buf
);
REQUIRE
(
fmt
::
to_string
(
buf
)
==
expected
);
}
void
test_pad6
(
std
::
size_t
n
,
const
char
*
expected
)
{
fmt
::
memory_buffer
buf
;
spdlog
::
details
::
fmt_helper
::
pad6
(
n
,
buf
);
REQUIRE
(
fmt
::
to_string
(
buf
)
==
expected
);
}
TEST_CASE
(
"pad2"
,
"[fmt_helper]"
)
{
test_pad2
(
0
,
"00"
);
test_pad2
(
3
,
"03"
);
test_pad2
(
23
,
"23"
);
test_pad2
(
123
,
"123"
);
test_pad2
(
1234
,
"1234"
);
test_pad2
(
-
5
,
"-5"
);
}
TEST_CASE
(
"pad3"
,
"[fmt_helper]"
)
{
test_pad3
(
0
,
"000"
);
test_pad3
(
3
,
"003"
);
test_pad3
(
23
,
"023"
);
test_pad3
(
123
,
"123"
);
test_pad3
(
1234
,
"1234"
);
test_pad3
(
-
5
,
"-05"
);
}
TEST_CASE
(
"pad6"
,
"[fmt_helper]"
)
{
test_pad6
(
0
,
"000000"
);
test_pad6
(
3
,
"000003"
);
test_pad6
(
23
,
"000023"
);
test_pad6
(
123
,
"000123"
);
test_pad6
(
1234
,
"001234"
);
test_pad6
(
12345
,
"012345"
);
test_pad6
(
123456
,
"123456"
);
}
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