mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
Core: FileMapping refactored
This commit is contained in:
parent
21f88fa4fd
commit
ac0504c1b7
7 changed files with 140 additions and 108 deletions
33
autotest/FileMapping/FileMapping.cpp
Normal file
33
autotest/FileMapping/FileMapping.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
String test;
|
||||
for(int i = 0; i < 100; i++)
|
||||
test << i << " " << i * 12345678 << "\n";
|
||||
|
||||
int sz = test.GetCount();
|
||||
|
||||
String path = GetHomeDirFile("mapped");
|
||||
|
||||
{
|
||||
FileMapping m;
|
||||
m.Create(path, sz);
|
||||
memcpy(m.Map(), ~test, sz);
|
||||
}
|
||||
|
||||
ASSERT(LoadFile(path) == test);
|
||||
|
||||
{
|
||||
FileMapping m(path);
|
||||
ASSERT(memcmp(m.Map(), ~test, sz) == 0);
|
||||
}
|
||||
|
||||
DeleteFile(path);
|
||||
|
||||
LOG("============ OK");
|
||||
}
|
||||
9
autotest/FileMapping/FileMapping.upp
Normal file
9
autotest/FileMapping/FileMapping.upp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
FileMapping.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "";
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue