summaryrefslogtreecommitdiff
path: root/test/test_file.cpp
diff options
context:
space:
mode:
authorDominick Allen <djallen@librehumanitas.org>2025-01-02 18:49:56 -0600
committerDominick Allen <djallen@librehumanitas.org>2025-01-02 18:49:56 -0600
commitd5a174a6d4f8be5e7cffe7c2adbb8db23b578f56 (patch)
tree536a10802f418e3e71f3828597439537d9e62f21 /test/test_file.cpp
parent908fdf06b41f9084d719a4b517c868b1ad29a9ac (diff)
Fixing errors in Vector.
Diffstat (limited to 'test/test_file.cpp')
-rw-r--r--test/test_file.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/test/test_file.cpp b/test/test_file.cpp
index 12cfb98..c1ce4f1 100644
--- a/test/test_file.cpp
+++ b/test/test_file.cpp
@@ -21,11 +21,11 @@
#include "test_common.hpp"
#include "gtest/gtest.h"
-#include <algorithm>
#include <cerrno>
#include <fcntl.h>
#include <ftw.h>
-#include <ranges>
+
+// NOLINTBEGIN(readability-magic-numbers)
namespace fud {
@@ -121,6 +121,7 @@ TEST(FudBufferedFile, OpenReadWrite)
ASSERT_EQ(bufferedFile.file().size().getOkayOr(std::numeric_limits<size_t>::max()), 0);
auto writeResult = bufferedFile.write(
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
reinterpret_cast<const std::byte*>(testName.data()),
testName.size(),
NullOpt);
@@ -132,6 +133,7 @@ TEST(FudBufferedFile, OpenReadWrite)
ASSERT_EQ(bufferedFile.seekStart(), FudStatus::Success);
Vector<utf8> output{Vector<utf8>::withSize(testName.size()).takeOkay()};
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
auto readResult = bufferedFile.read(reinterpret_cast<std::byte*>(output.data()), testName.size(), NullOpt);
ASSERT_EQ(readResult, expected);
@@ -142,11 +144,13 @@ TEST(FudBufferedFile, OpenReadWrite)
ASSERT_EQ(bufferedFile.seekStart(), FudStatus::Success);
expected.bytesDrained = 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
readResult = bufferedFile.read(reinterpret_cast<std::byte*>(output.data()), 1, NullOpt);
ASSERT_EQ(readResult, expected);
EXPECT_EQ(output[0], testName.data()[0]);
expected.bytesDrained = testName.size() - 2;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
readResult = bufferedFile.read(reinterpret_cast<std::byte*>(output.data()) + 1, testName.size() - 2, NullOpt);
ASSERT_EQ(readResult, expected);
EXPECT_EQ(
@@ -154,6 +158,7 @@ TEST(FudBufferedFile, OpenReadWrite)
compareMem(output.data() + 1, output.size() - 1, testName.data() + 1, testName.size() - 2).takeOkayOr(-1));
expected.bytesDrained = 1;
+ // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
readResult = bufferedFile.read(reinterpret_cast<std::byte*>(output.data()), 1, NullOpt);
EXPECT_TRUE(readResult.status == FudStatus::Success || readResult.status == FudStatus::Partial);
@@ -164,3 +169,5 @@ TEST(FudBufferedFile, OpenReadWrite)
}
} // namespace fud
+
+// NOLINTEND(readability-magic-numbers)