MCPcopy Create free account
hub / github.com/SmingHub/Sming / readCheck

Method readCheck

tests/HostTests/modules/Spiffs.cpp:132–160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 }
131
132 void readCheck(IFS::FileSystem* fsOld, IFS::FileSystem* fsNew)
133 {
134 DirHandle dir{};
135 int res = fsOld->opendir(nullptr, dir);
136 if(res < 0) {
137 debug_e("opendir failed: %s", fsOld->getErrorString(res).c_str());
138 TEST_ASSERT(false);
139 return;
140 }
141
142 FileNameStat stat;
143 while((res = fsOld->readdir(dir, stat)) >= 0) {
144 FileStat statNew;
145 fsNew->stat(stat.name.buffer, &statNew);
146 debug_i("File '%s' size %u / %u", stat.name.buffer, stat.size, statNew.size);
147
148 String oldContent = fsOld->getContent(stat.name.buffer);
149 CHECK(oldContent);
150 String newContent = fsNew->getContent(stat.name.buffer);
151 CHECK(newContent);
152
153 CHECK_EQ(newContent, oldContent);
154 }
155
156 CHECK_EQ(res, IFS::Error::NoMoreFiles);
157 debug_i("readdir(): %s", fsOld->getErrorString(res).c_str());
158
159 fsOld->closedir(dir);
160 }
161#endif
162};
163

Callers

nothing calls this directly

Calls 6

opendirMethod · 0.80
readdirMethod · 0.80
closedirMethod · 0.80
c_strMethod · 0.45
getErrorStringMethod · 0.45
statMethod · 0.45

Tested by

no test coverage detected