From 9b9bbca910c1c15fff8e5355278cd37a2638b85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 4 Jun 2009 12:11:37 +0000 Subject: [PATCH] * Fixed Map::GetFileMap(), added some more tests. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30958 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../system/kernel/cache/file_map_test.cpp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/tests/system/kernel/cache/file_map_test.cpp b/src/tests/system/kernel/cache/file_map_test.cpp index dd75b56a64..ffebbf71f5 100644 --- a/src/tests/system/kernel/cache/file_map_test.cpp +++ b/src/tests/system/kernel/cache/file_map_test.cpp @@ -194,7 +194,7 @@ Map::GetFileMap(off_t offset, off_t length, file_io_vec* vecs, if (count >= *_vecCount) return B_BUFFER_OVERFLOW; if ((uint32)index >= fCount) - return B_OK; + break; off_t diff = offset - fOffsets[index]; vecs[count].offset = fVecs[index].offset + diff; @@ -208,6 +208,7 @@ Map::GetFileMap(off_t offset, off_t length, file_io_vec* vecs, count++; } + *_vecCount = count; return B_OK; } @@ -314,5 +315,22 @@ main(int argc, char** argv) map.Add(0, 8192, 1000).SetSize(7777); map.Test(); + map.SetTo("shrink2", 8888); + map.Add(0, 10000, 3330000); + map.Test(); + map.SetSize(0); + map.SetSize(4444); + map.Clear(); + map.Add(0, 5000, 2220000); + map.Test(); + + map.SetTo("shrink3", 256000); + map.Add(0, 98304, 188074464); + map.Add(98304, 38912, 189057024); + map.Add(137216, 118784, 189177856); + map.Test(); + map.SetSize(0); + map.Test(); + return 0; }