diff --git a/test/test.cpp b/test/test.cpp index 074293e..37b5247 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -8,21 +8,17 @@ int main() { - // Both are 40 bytes on UNIX, 48 on Windows (TODO verify). - //std::printf("sizeof(mio::mmap_source) = %i bytes\n", sizeof(mio::mmap_source)); - //std::printf("sizeof(mio::mmap_sink) = %i bytes\n", sizeof(mio::mmap_source)); - - const char* file_path = "test-file"; + const char* path = "test-file"; // Fill buffer, then write it to file. std::string buffer(0x4000 - 250, 'M'); - std::ofstream file(file_path); + std::ofstream file(path); file << buffer; file.close(); // Map the region of the file to which buffer was written. std::error_code error; - mio::mmap_source file_view = mio::make_mmap_source(file_path, + mio::mmap_source file_view = mio::make_mmap_source(path, 0, mio::mmap_source::use_full_file_size, error); if(error) { @@ -53,7 +49,6 @@ int main() mio::mmap_source m; - // FIXME move assignment DOES NOT WORK! // See if mapping an invalid file results in an error. m = mio::make_mmap_source("garbage-that-hopefully-doesnt-exist", 0, 0, error); CHECK_INVALID_MMAP(m); @@ -70,14 +65,8 @@ int main() CHECK_INVALID_MMAP(m); // Invalid offset? - m = mio::make_mmap_source(file_path, 100 * buffer.size(), buffer.size(), error); + m = mio::make_mmap_source(path, 100 * buffer.size(), buffer.size(), error); CHECK_INVALID_MMAP(m); std::printf("all tests passed!\n"); } - -// TODO consider the following API: type safe length and offset parameters, as these -// two are easily interchanged due to the same type, with the optional feature of -// arbitrary ordering. -//mio::mmap_source file_view = mio::make_mmap_source(file_path, -// mio::offset(0), mio::length(buffer.size()), error);