aboutsummaryrefslogtreecommitdiff
path: root/kernel/src/filesystem/rootfs/inode.tests.cpp
blob: f4b634fa1842f49eb349007a2959da047ad57305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <kernel/filesystem/rootfs/inode.hpp>

#include <kstd/memory>
#include <kstd/print>
#include <kstd/vector>

#include <catch2/catch_test_macros.hpp>

SCENARIO("Rootfs inode read/write", "[filesystem][rootfs][inode]")
{
  GIVEN("a rootfs inode")
  {
    auto inode = kernel::filesystem::rootfs::inode{};

    WHEN("reading from the inode")
    {
      kstd::vector<char> buffer(10);
      auto bytes_read = inode.read(buffer.data(), 0, buffer.size());

      THEN("no bytes are read")
      {
        REQUIRE(bytes_read == 0);
      }
    }

    WHEN("writing to the inode")
    {
      kstd::vector<char> buffer(10, 'x');
      auto bytes_written = inode.write(buffer.data(), 0, buffer.size());

      THEN("no bytes are written")
      {
        REQUIRE(bytes_written == 0);
      }
    }
  }
}