| 333 | |
| 334 | #ifdef _DEBUG |
| 335 | void MMapTest() |
| 336 | { |
| 337 | // write |
| 338 | { |
| 339 | LVStreamRef stream = LVMapFileStream( "c:\\cr3\\mapfile.dat", LVOM_APPEND, 1000000 ); |
| 340 | LVStreamBufferRef buf = stream->GetWriteBuffer( 0, stream->GetSize() ); |
| 341 | lUInt32 * p = (lUInt32*)buf->getReadWrite(); |
| 342 | for ( lUInt32 i=0; i<1000000/4; i++ ) { |
| 343 | p[i] = i; |
| 344 | } |
| 345 | } |
| 346 | // read |
| 347 | { |
| 348 | LVStreamRef stream = LVMapFileStream( "c:\\cr3\\mapfile.dat", LVOM_READ, 1000000 ); |
| 349 | LVStreamBufferRef buf = stream->GetReadBuffer( 0, stream->GetSize() ); |
| 350 | const lUInt32 * p = (const lUInt32*)buf->getReadOnly(); |
| 351 | for ( lUInt32 i=0; i<1000000/4; i++ ) { |
| 352 | if ( p[i]!=i ) { |
| 353 | CRLog::error("MMapTest failed!!!"); |
| 354 | break; |
| 355 | } |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | #endif |
| 360 | |
| 361 | int APIENTRY WinMain(HINSTANCE hInstance, |
no test coverage detected