3
3
#include < gtest/gtest.h>
4
4
#include < utils/coroutine/SyncWait.hpp>
5
5
6
-
7
- constexpr auto HelloWorldData = FilesystemParamInterfaceData{ .fileData = " Hello world!" , .filename = " helloworld.txt" };
6
+ constexpr auto HelloWorldData =
7
+ FilesystemParamInterfaceData{.fileData = " Hello world!" , .filename = " helloworld.txt" };
8
8
9
9
constexpr auto kNmeaDataExample = std::string_view{
10
10
" $GPGSA,A,1,,,,,,,,,,,,,,,* 1E\n "
@@ -40,35 +40,36 @@ constexpr auto kNmeaDataExample = std::string_view{
40
40
41
41
};
42
42
43
- constexpr auto NmeaData = FilesystemParamInterfaceData{ . fileData = kNmeaDataExample ,. filename = " nmea_data.txt " };
44
-
43
+ constexpr auto NmeaData =
44
+ FilesystemParamInterfaceData{. fileData = kNmeaDataExample , . filename = " nmea_data.txt " };
45
45
46
46
TEST_P (FilesystemTopLevelTestFixture, CheckFileReadWriteProcedure)
47
47
{
48
- spdlog::warn (" simpleRwTest begin" );
49
48
auto lfs = m_testFilesystem.fsInstance ();
50
49
{
51
- auto filename = std::move (CoroUtils::syncWait (m_testFilesystem.openFile (GetParam ().filename )));
52
- CoroUtils::syncWait (filename.write (
53
- std::span (reinterpret_cast <const std::uint8_t *>(GetParam ().fileData .data ()), GetParam ().fileData .size ())));
50
+ auto filePath = GetParam ().filename ;
51
+ auto filename = std::move (CoroUtils::syncWait (m_testFilesystem.openFile (filePath)));
52
+ CoroUtils::syncWait (filename.write (std::span (
53
+ reinterpret_cast <const std::uint8_t *>(GetParam ().fileData .data ()),
54
+ GetParam ().fileData .size ())));
54
55
}
55
56
56
57
std::vector<std::uint8_t > readFrom;
57
58
readFrom.resize (GetParam ().fileData .size ());
58
59
59
60
{
60
- auto holdedFile = std::move (CoroUtils::syncWait (m_testFilesystem.openFile (GetParam ().filename )));
61
- auto resultRead = CoroUtils::syncWait ( holdedFile.read (std::span (readFrom.data (), GetParam ().fileData .size ())));
61
+ auto holdedFile =
62
+ std::move (CoroUtils::syncWait (m_testFilesystem.openFile (GetParam ().filename )));
63
+ auto resultRead = CoroUtils::syncWait (
64
+ holdedFile.read (std::span (readFrom.data (), GetParam ().fileData .size ())));
62
65
}
63
66
64
67
auto kCompareStringView {
65
- std::string_view{reinterpret_cast <const char *>(readFrom.data ()), readFrom.size ()} };
68
+ std::string_view{reinterpret_cast <const char *>(readFrom.data ()), readFrom.size ()}};
66
69
EXPECT_EQ (kCompareStringView , GetParam ().fileData );
67
70
}
68
71
69
-
70
72
INSTANTIATE_TEST_SUITE_P (
71
73
FilesystemTopLevelTesting,
72
74
FilesystemTopLevelTestFixture,
73
- ::testing::Values (
74
- FilesystemParamInterfaceData{}));
75
+ ::testing::Values (HelloWorldData, NmeaData));
0 commit comments