MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / testPutGet

Function testPutGet

tests/cpmfs.cc:199–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197#if 0
198
199static void testPutGet()
200{
201 auto sectors = std::make_shared<TestSectorInterface>();
202 auto fs = Filesystem::createCpmFsFilesystem(
203 globalConfig()->filesystem(), sectors);
204 fs->create(true, "volume");
205
206 fs->putFile(Path("0:FILE1"), Bytes{1, 2, 3, 4});
207 fs->putFile(Path("0:FILE2"), Bytes{5, 6, 7, 8});
208
209 dynamic_cast<HasMount*>(fs.get())->mount();
210 std::vector<bool> bitmap =
211 dynamic_cast<HasBitmap*>(fs.get())->getBitmapForDebugging();
212 AssertThat(bitmap,
213 Equals(std::vector<bool>{
214 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}));
215
216 auto directory = getBlock(sectors, 0, 256).slice(0, 64);
217 AssertThat(directory,
218 Equals(createDirent("FILE1", 0, 1, {1}) +
219 createDirent("FILE2", 0, 1, {2})));
220
221 auto file1 = getBlock(sectors, 1, 8).slice(0, 8);
222 AssertThat(file1, Equals(Bytes{1, 2, 3, 4, 0, 0, 0, 0}));
223
224 auto file2 = getBlock(sectors, 2, 8).slice(0, 8);
225 AssertThat(file2, Equals(Bytes{5, 6, 7, 8, 0, 0, 0, 0}));
226}
227
228static void testPutBigFile()
229{

Callers 1

mainFunction · 0.85

Calls 9

getBlockFunction · 0.85
createDirentFunction · 0.85
getBitmapForDebuggingMethod · 0.80
sliceMethod · 0.80
PathClass · 0.50
createMethod · 0.45
putFileMethod · 0.45
mountMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected