diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-07-14 13:21:50 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-07-14 13:21:50 +0200 |
commit | f5ea5b655d2d98298d68829aa031740a63b1b33d (patch) | |
tree | 44fbda4b55ab0984ab45fb022faabc99202dd4f4 /vespalib | |
parent | 04c653308e09f05fbc1dc137d3a4290e47a76054 (diff) |
Use std::filesystem in buffered file unit test.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/fastlib/io/bufferedfiletest.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/vespalib/src/tests/fastlib/io/bufferedfiletest.cpp b/vespalib/src/tests/fastlib/io/bufferedfiletest.cpp index 8aa9b943419..edf38122202 100644 --- a/vespalib/src/tests/fastlib/io/bufferedfiletest.cpp +++ b/vespalib/src/tests/fastlib/io/bufferedfiletest.cpp @@ -1,17 +1,26 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/vespalib/testkit/test_kit.h> +#include <filesystem> +namespace { + +void remove_testfiles() +{ + std::filesystem::remove(std::filesystem::path("testfile1")); + std::filesystem::remove(std::filesystem::path("testfile2")); + std::filesystem::remove(std::filesystem::path("testfile3")); + std::filesystem::remove(std::filesystem::path("testfile4")); + std::filesystem::remove(std::filesystem::path("testfile5")); +} + +} TEST("main") { int value = 0; FastOS_StatInfo statInfo; - FastOS_File::Delete("testfile1"); - FastOS_File::Delete("testfile2"); - FastOS_File::Delete("testfile3"); - FastOS_File::Delete("testfile4"); - FastOS_File::Delete("testfile5"); + remove_testfiles(); Fast_BufferedFile bufFile(4096); @@ -84,11 +93,7 @@ TEST("main") { } printf (" -- SUCCESS\n\n"); - FastOS_File::Delete("testfile1"); - FastOS_File::Delete("testfile2"); - FastOS_File::Delete("testfile3"); - FastOS_File::Delete("testfile4"); - FastOS_File::Delete("testfile5"); + remove_testfiles(); printf ("All tests OK for bufferedfiletest\n"); printf (" -- SUCCESS\n\n"); |