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
a96092ac
Commit
a96092ac
authored
Apr 03, 2016
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests small update
parent
e9633a53
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
tests/file_helper.cpp
tests/file_helper.cpp
+10
-10
tests/utils.cpp
tests/utils.cpp
+3
-3
No files found.
tests/file_helper.cpp
View file @
a96092ac
...
...
@@ -5,7 +5,7 @@
using
namespace
spdlog
::
details
;
static
const
std
::
string
filename
=
"logs/file_helper_test.txt"
;
static
const
std
::
string
target_
filename
=
"logs/file_helper_test.txt"
;
static
void
write_with_helper
(
file_helper
&
helper
,
size_t
howmany
)
{
...
...
@@ -20,8 +20,8 @@ TEST_CASE("file_helper_filename", "[file_helper::filename()]]")
prepare_logdir
();
file_helper
helper
(
false
);
helper
.
open
(
filename
);
REQUIRE
(
helper
.
filename
()
==
filename
);
helper
.
open
(
target_
filename
);
REQUIRE
(
helper
.
filename
()
==
target_
filename
);
}
...
...
@@ -32,28 +32,28 @@ TEST_CASE("file_helper_size", "[file_helper::size()]]")
auto
expected_size
=
123
;
{
file_helper
helper
(
true
);
helper
.
open
(
filename
);
helper
.
open
(
target_
filename
);
write_with_helper
(
helper
,
expected_size
);
REQUIRE
(
helper
.
size
()
==
expected_size
);
}
REQUIRE
(
get_filesize
(
filename
)
==
expected_size
);
REQUIRE
(
get_filesize
(
target_
filename
)
==
expected_size
);
}
TEST_CASE
(
"file_helper_exists"
,
"[file_helper::file_exists()]]"
)
{
prepare_logdir
();
REQUIRE
(
!
file_helper
::
file_exists
(
filename
));
REQUIRE
(
!
file_helper
::
file_exists
(
target_
filename
));
file_helper
helper
(
false
);
helper
.
open
(
filename
);
REQUIRE
(
file_helper
::
file_exists
(
filename
));
helper
.
open
(
target_
filename
);
REQUIRE
(
file_helper
::
file_exists
(
target_
filename
));
}
TEST_CASE
(
"file_helper_reopen"
,
"[file_helper::reopen()]]"
)
{
prepare_logdir
();
file_helper
helper
(
true
);
helper
.
open
(
filename
);
helper
.
open
(
target_
filename
);
write_with_helper
(
helper
,
12
);
REQUIRE
(
helper
.
size
()
==
12
);
helper
.
reopen
(
true
);
...
...
@@ -65,7 +65,7 @@ TEST_CASE("file_helper_reopen2", "[file_helper::reopen(false)]]")
prepare_logdir
();
auto
expected_size
=
14
;
file_helper
helper
(
true
);
helper
.
open
(
filename
);
helper
.
open
(
target_
filename
);
write_with_helper
(
helper
,
expected_size
);
REQUIRE
(
helper
.
size
()
==
expected_size
);
helper
.
reopen
(
false
);
...
...
tests/utils.cpp
View file @
a96092ac
...
...
@@ -4,10 +4,11 @@ void prepare_logdir()
{
spdlog
::
drop_all
();
#ifdef _WIN32
system
(
"del /F /Q logs
\\
*"
);
auto
rv
=
system
(
"del /F /Q logs
\\
*"
);
#else
system
(
"rm -f logs/*"
);
auto
rv
=
system
(
"rm -f logs/*"
);
#endif
(
void
)
rv
;
}
...
...
@@ -42,4 +43,3 @@ std::size_t get_filesize(const std::string& filename)
return
ifs
.
tellg
();
}
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