12 std::array<uint8_t, 10> buffer = {
13 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
15 std::array<uint8_t, 100> tmp;
46 for (
auto i :
xrange(10)) {
47 CHECK(tmp[i] == (i + 1));
52 CHECK_THROWS(file.
write(std::span{tmp.data(), file.getSize()}));
TEST_CASE("MemoryBufferFile")
void seek(size_t pos)
Move read/write pointer to the specified position.
bool isReadOnly() const
Check if this file is readonly.
void read(std::span< uint8_t > buffer)
Read from file.
void write(std::span< const uint8_t > buffer)
Write to file.
size_t getSize()
Returns the size of this file.
size_t getPos()
Get the current position of the read/write pointer.
This file implemented 3 utility functions:
File memory_buffer_file(std::span< const uint8_t > buffer)
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)
constexpr auto xrange(T e)