MCPcopy Create free account
hub / github.com/attermann/microReticulum / readFile

Function readFile

test/test_filesystem/test_filesystem.cpp:36–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34}
35
36void readFile(const char* file_path) {
37
38 size_t pre_memory = RNS::Utilities::Memory::heap_available();
39 TRACEF("testReadFile: pre-mem: %u", pre_memory);
40
41 {
42 RNS::Bytes data;
43 size_t read = RNS::Utilities::OS::read_file(file_path, data);
44 TEST_ASSERT_EQUAL_size_t(4, read);
45 TEST_ASSERT_EQUAL_STRING("test", data.toString().c_str());
46 }
47
48 size_t post_memory = RNS::Utilities::Memory::heap_available();
49 size_t diff_memory = (int)pre_memory - (int)post_memory;
50 TRACEF("testReadFile: post-mem: %u", post_memory);
51 TRACEF("testReadFile: diff-mem: %u", diff_memory);
52 TEST_ASSERT_EQUAL_size_t(0, diff_memory);
53
54}
55
56void overwriteFile(const char* file_path) {
57

Callers 1

testReadFileFunction · 0.85

Calls 1

toStringMethod · 0.45

Tested by

no test coverage detected