Add trailing '\n's to ok() calls.

This commit is contained in:
Francois Gouget 2004-01-26 20:23:25 +00:00 committed by Alexandre Julliard
parent 4e47ccb490
commit e18aa3f614
6 changed files with 325 additions and 327 deletions

View File

@ -68,7 +68,7 @@ static void test_enum_value(void)
static const WCHAR xxxW[] = {'x','x','x','x','x','x','x','x',0};
res = RegSetValueExA( hkey_main, "Test", 0, REG_SZ, (BYTE *)"foobar", 7 );
ok( res == 0, "RegSetValueExA failed error %ld", res );
ok( res == 0, "RegSetValueExA failed error %ld\n", res );
/* overflow both name and data */
val_count = 2;
@ -77,12 +77,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 2, "val_count set to %ld", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'", data );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
/* overflow name */
val_count = 3;
@ -91,15 +91,15 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
/* Win9x returns 2 as specified by MSDN but NT returns 3... */
ok( val_count == 2 || val_count == 3, "val_count set to %ld", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( val_count == 2 || val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
#if 0
/* v5.1.2600.0 (XP Home) does not touch value or data in this case */
ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'", value );
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data );
ok( !strcmp( value, "Te" ), "value set to '%s' instead of 'Te'\n", value );
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
#endif
/* overflow empty name */
@ -109,14 +109,14 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 0, "val_count set to %ld", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 0, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
#if 0
/* v5.1.2600.0 (XP Home) does not touch data in this case */
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'", data );
ok( !strcmp( data, "foobar" ), "data set to '%s' instead of 'foobar'\n", data );
#endif
/* overflow data */
@ -126,12 +126,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 20, "val_count set to %ld", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'", data );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 20, "val_count set to %ld\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "xxxxxxxxxx" ), "value set to '%s'\n", value );
ok( !strcmp( data, "xxxxxxxxxx" ), "data set to '%s'\n", data );
/* no overflow */
val_count = 20;
@ -140,12 +140,12 @@ static void test_enum_value(void)
strcpy( value, "xxxxxxxxxx" );
strcpy( data, "xxxxxxxxxx" );
res = RegEnumValueA( hkey_main, 0, value, &val_count, NULL, &type, data, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !strcmp( value, "Test" ), "value is '%s' instead of Test", value );
ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar", data );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7, "data_count set to %ld instead of 7\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !strcmp( value, "Test" ), "value is '%s' instead of Test\n", value );
ok( !strcmp( data, "foobar" ), "data is '%s' instead of foobar\n", data );
/* Unicode tests */
@ -153,7 +153,7 @@ static void test_enum_value(void)
res = RegSetValueExW( hkey_main, testW, 0, REG_SZ, (BYTE *)foobarW, 7*sizeof(WCHAR) );
if (res==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
goto CLEANUP;
ok( res == 0, "RegSetValueExW failed error %ld", res );
ok( res == 0, "RegSetValueExW failed error %ld\n", res );
/* overflow both name and data */
val_count = 2;
@ -162,12 +162,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 2, "val_count set to %ld", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 2, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* overflow name */
val_count = 3;
@ -176,12 +176,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 3, "val_count set to %ld", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 3, "val_count set to %ld\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, xxxW, sizeof(xxxW) ), "value modified\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* overflow data */
val_count = 20;
@ -190,12 +190,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified" );
ok( res == ERROR_MORE_DATA, "expected ERROR_MORE_DATA, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, xxxW, sizeof(xxxW) ), "data modified\n" );
/* no overflow */
val_count = 20;
@ -204,12 +204,12 @@ static void test_enum_value(void)
memcpy( valueW, xxxW, sizeof(xxxW) );
memcpy( dataW, xxxW, sizeof(xxxW) );
res = RegEnumValueW( hkey_main, 0, valueW, &val_count, NULL, &type, (BYTE*)dataW, &data_count );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld", res );
ok( val_count == 4, "val_count set to %ld instead of 4", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'" );
ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'" );
ok( res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %ld\n", res );
ok( val_count == 4, "val_count set to %ld instead of 4\n", val_count );
ok( data_count == 7*sizeof(WCHAR), "data_count set to %ld instead of 7*sizeof(WCHAR)\n", data_count );
ok( type == REG_SZ, "type %ld is not REG_SZ\n", type );
ok( !memcmp( valueW, testW, sizeof(testW) ), "value is not 'Test'\n" );
ok( !memcmp( dataW, foobarW, sizeof(foobarW) ), "data is not 'foobar'\n" );
CLEANUP:
/* cleanup */

View File

@ -57,7 +57,7 @@ static void test_Heap(void)
/* Retrieve the page size for this system */
sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo);
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size");
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n");
/* Create a Heap with a minimum and maximum size */
/* Note that Windows and Wine seem to behave a bit differently with respect
@ -76,7 +76,7 @@ static void test_Heap(void)
nearest page boundary
*/
mem1=HeapAlloc(heap,0,5*memchunk+1);
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have");
ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n");
if(mem1) {
HeapFree(heap,0,mem1);
}
@ -84,44 +84,44 @@ static void test_Heap(void)
/* Check that a normal alloc works */
mem1=HeapAlloc(heap,0,memchunk);
ok(mem1!=NULL,"HeapAlloc failed");
ok(mem1!=NULL,"HeapAlloc failed\n");
if(mem1) {
ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block");
ok(HeapSize(heap,0,mem1)>=memchunk, "HeapAlloc should return a big enough memory block\n");
}
/* Check that a 'zeroing' alloc works */
mem2=HeapAlloc(heap,HEAP_ZERO_MEMORY,memchunk);
ok(mem2!=NULL,"HeapAlloc failed");
ok(mem2!=NULL,"HeapAlloc failed\n");
if(mem2) {
ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block");
ok(HeapSize(heap,0,mem2)>=memchunk,"HeapAlloc should return a big enough memory block\n");
error=0;
for(i=0;i<memchunk;i++) {
if(mem2[i]!=0) {
error=1;
}
}
ok(!error,"HeapAlloc should have zeroed out it's allocated memory");
ok(!error,"HeapAlloc should have zeroed out it's allocated memory\n");
}
/* Check that HeapAlloc returns NULL when requested way too much memory */
mem3=HeapAlloc(heap,0,5*memchunk);
ok(mem3==NULL,"HeapAlloc should return NULL");
ok(mem3==NULL,"HeapAlloc should return NULL\n");
if(mem3) {
ok(HeapFree(heap,0,mem3),"HeapFree didn't pass successfully");
ok(HeapFree(heap,0,mem3),"HeapFree didn't pass successfully\n");
}
/* Check that HeapRealloc works */
mem2a=HeapReAlloc(heap,HEAP_ZERO_MEMORY,mem2,memchunk+5*sysInfo.dwPageSize);
ok(mem2a!=NULL,"HeapReAlloc failed");
ok(mem2a!=NULL,"HeapReAlloc failed\n");
if(mem2a) {
ok(HeapSize(heap,0,mem2a)>=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed");
ok(HeapSize(heap,0,mem2a)>=memchunk+5*sysInfo.dwPageSize,"HeapReAlloc failed\n");
error=0;
for(i=0;i<5*sysInfo.dwPageSize;i++) {
if(mem2a[memchunk+i]!=0) {
error=1;
}
}
ok(!error,"HeapReAlloc should have zeroed out it's allocated memory");
ok(!error,"HeapReAlloc should have zeroed out it's allocated memory\n");
}
/* Check that HeapRealloc honours HEAP_REALLOC_IN_PLACE_ONLY */
@ -132,32 +132,32 @@ static void test_Heap(void)
error=1;
}
}
ok(mem1a==NULL || error==0,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY");
ok(mem1a==NULL || error==0,"HeapReAlloc didn't honour HEAP_REALLOC_IN_PLACE_ONLY\n");
/* Check that HeapFree works correctly */
if(mem1a) {
ok(HeapFree(heap,0,mem1a),"HeapFree failed");
ok(HeapFree(heap,0,mem1a),"HeapFree failed\n");
} else {
ok(HeapFree(heap,0,mem1),"HeapFree failed");
ok(HeapFree(heap,0,mem1),"HeapFree failed\n");
}
if(mem2a) {
ok(HeapFree(heap,0,mem2a),"HeapFree failed");
ok(HeapFree(heap,0,mem2a),"HeapFree failed\n");
} else {
ok(HeapFree(heap,0,mem2),"HeapFree failed");
ok(HeapFree(heap,0,mem2),"HeapFree failed\n");
}
/* 0-length buffer */
mem1 = HeapAlloc(heap, 0, 0);
ok(mem1 != NULL, "Reserved memory");
ok(mem1 != NULL, "Reserved memory\n");
dwSize = HeapSize(heap, 0, mem1);
/* should work with 0-length buffer */
ok((dwSize >= 0) && (dwSize < 0xFFFFFFFF),
"The size of the 0-length buffer");
ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer");
"The size of the 0-length buffer\n");
ok(HeapFree(heap, 0, mem1), "Freed the 0-length buffer\n");
/* Check that HeapDestry works */
ok(HeapDestroy(heap),"HeapDestroy failed");
ok(HeapDestroy(heap),"HeapDestroy failed\n");
}
/* The following functions don't have tests, because either I don't know how
@ -183,18 +183,18 @@ static void test_Global(void)
SetLastError(NO_ERROR);
/* Check that a normal alloc works */
mem1=GlobalAlloc(0,memchunk);
ok(mem1!=NULL,"GlobalAlloc failed");
ok(mem1!=NULL,"GlobalAlloc failed\n");
if(mem1) {
ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block");
ok(GlobalSize(mem1)>=memchunk, "GlobalAlloc should return a big enough memory block\n");
}
/* Check that a 'zeroing' alloc works */
mem2=GlobalAlloc(GMEM_ZEROINIT,memchunk);
ok(mem2!=NULL,"GlobalAlloc failed: error=%ld",GetLastError());
ok(mem2!=NULL,"GlobalAlloc failed: error=%ld\n",GetLastError());
if(mem2) {
ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block");
ok(GlobalSize(mem2)>=memchunk,"GlobalAlloc should return a big enough memory block\n");
mem2ptr=GlobalLock(mem2);
ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated");
ok(mem2ptr==mem2,"GlobalLock should have returned the same memory as was allocated\n");
if(mem2ptr) {
error=0;
for(i=0;i<memchunk;i++) {
@ -202,27 +202,27 @@ static void test_Global(void)
error=1;
}
}
ok(!error,"GlobalAlloc should have zeroed out it's allocated memory");
ok(!error,"GlobalAlloc should have zeroed out it's allocated memory\n");
}
}
/* Check that GlobalReAlloc works */
/* Check that we can change GMEM_FIXED to GMEM_MOVEABLE */
mem2a=GlobalReAlloc(mem2,0,GMEM_MODIFY | GMEM_MOVEABLE);
ok(mem2a!=NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE: error=%ld",GetLastError());
ok(mem2a!=NULL,"GlobalReAlloc failed to convert FIXED to MOVEABLE: error=%ld\n",GetLastError());
if(mem2a!=NULL) {
mem2=mem2a;
}
mem2ptr=GlobalLock(mem2a);
ok(mem2ptr!=NULL && !GlobalUnlock(mem2a)&&GetLastError()==NO_ERROR,
"Converting from FIXED to MOVEABLE didn't REALLY work");
"Converting from FIXED to MOVEABLE didn't REALLY work\n");
/* Check that ReAllocing memory works as expected */
mem2a=GlobalReAlloc(mem2,2*memchunk,GMEM_MOVEABLE | GMEM_ZEROINIT);
ok(mem2a!=NULL,"GlobalReAlloc failed");
ok(mem2a!=NULL,"GlobalReAlloc failed\n");
if(mem2a) {
ok(GlobalSize(mem2a)>=2*memchunk,"GlobalReAlloc failed");
ok(GlobalSize(mem2a)>=2*memchunk,"GlobalReAlloc failed\n");
mem2ptr=GlobalLock(mem2a);
ok(mem2ptr!=NULL,"GlobalLock Failed.");
ok(mem2ptr!=NULL,"GlobalLock Failed\n");
if(mem2ptr) {
error=0;
for(i=0;i<memchunk;i++) {
@ -230,25 +230,25 @@ static void test_Global(void)
error=1;
}
}
ok(!error,"GlobalReAlloc should have zeroed out it's allocated memory");
ok(!error,"GlobalReAlloc should have zeroed out it's allocated memory\n");
/* Check that GlobalHandle works */
mem2b=GlobalHandle(mem2ptr);
ok(mem2b==mem2a,"GlobalHandle didn't return the correct memory handle");
ok(mem2b==mem2a,"GlobalHandle didn't return the correct memory handle\n");
/* Check that we can't discard locked memory */
mem2b=GlobalDiscard(mem2a);
ok(mem2b==NULL,"Discarded memory we shouldn't have");
ok(!GlobalUnlock(mem2a) && GetLastError()==NO_ERROR,"GlobalUnlock Failed.");
ok(mem2b==NULL,"Discarded memory we shouldn't have\n");
ok(!GlobalUnlock(mem2a) && GetLastError()==NO_ERROR,"GlobalUnlock Failed\n");
}
}
if(mem1) {
ok(GlobalFree(mem1)==NULL,"GlobalFree failed");
ok(GlobalFree(mem1)==NULL,"GlobalFree failed\n");
}
if(mem2a) {
ok(GlobalFree(mem2a)==NULL,"GlobalFree failed");
ok(GlobalFree(mem2a)==NULL,"GlobalFree failed\n");
} else {
ok(GlobalFree(mem2)==NULL,"GlobalFree failed");
ok(GlobalFree(mem2)==NULL,"GlobalFree failed\n");
}
}
@ -274,18 +274,18 @@ static void test_Local(void)
/* Check that a normal alloc works */
mem1=LocalAlloc(0,memchunk);
ok(mem1!=NULL,"LocalAlloc failed: error=%ld",GetLastError());
ok(mem1!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
if(mem1) {
ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block");
ok(LocalSize(mem1)>=memchunk, "LocalAlloc should return a big enough memory block\n");
}
/* Check that a 'zeroing' and lock alloc works */
mem2=LocalAlloc(LMEM_ZEROINIT|LMEM_MOVEABLE,memchunk);
ok(mem2!=NULL,"LocalAlloc failed: error=%ld",GetLastError());
ok(mem2!=NULL,"LocalAlloc failed: error=%ld\n",GetLastError());
if(mem2) {
ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block");
ok(LocalSize(mem2)>=memchunk,"LocalAlloc should return a big enough memory block\n");
mem2ptr=LocalLock(mem2);
ok(mem2ptr!=NULL,"LocalLock: error=%ld",GetLastError());
ok(mem2ptr!=NULL,"LocalLock: error=%ld\n",GetLastError());
if(mem2ptr) {
error=0;
for(i=0;i<memchunk;i++) {
@ -293,27 +293,27 @@ static void test_Local(void)
error=1;
}
}
ok(!error,"LocalAlloc should have zeroed out it's allocated memory");
ok(!error,"LocalAlloc should have zeroed out it's allocated memory\n");
SetLastError(0);
error=LocalUnlock(mem2);
ok(error==0 && GetLastError()==NO_ERROR,
"LocalUnlock Failed: rc=%d err=%ld",error,GetLastError());
"LocalUnlock Failed: rc=%d err=%ld\n",error,GetLastError());
}
}
mem2a=LocalFree(mem2);
ok(mem2a==NULL, "LocalFree failed: %p",mem2a);
ok(mem2a==NULL, "LocalFree failed: %p\n",mem2a);
/* Reallocate mem2 as moveable memory */
mem2=LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT,memchunk);
ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%ld",GetLastError());
ok(mem2!=NULL, "LocalAlloc failed to create moveable memory, error=%ld\n",GetLastError());
/* Check that ReAllocing memory works as expected */
mem2a=LocalReAlloc(mem2,2*memchunk,LMEM_MOVEABLE | LMEM_ZEROINIT);
ok(mem2a!=NULL,"LocalReAlloc failed, error=%ld",GetLastError());
ok(mem2a!=NULL,"LocalReAlloc failed, error=%ld\n",GetLastError());
if(mem2a) {
ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed");
ok(LocalSize(mem2a)>=2*memchunk,"LocalReAlloc failed\n");
mem2ptr=LocalLock(mem2a);
ok(mem2ptr!=NULL,"LocalLock Failed.");
ok(mem2ptr!=NULL,"LocalLock Failed\n");
if(mem2ptr) {
error=0;
for(i=0;i<memchunk;i++) {
@ -321,24 +321,24 @@ static void test_Local(void)
error=1;
}
}
ok(!error,"LocalReAlloc should have zeroed out it's allocated memory");
ok(!error,"LocalReAlloc should have zeroed out it's allocated memory\n");
/* Check that LocalHandle works */
mem2b=LocalHandle(mem2ptr);
ok(mem2b==mem2a,"LocalHandle didn't return the correct memory handle");
ok(mem2b==mem2a,"LocalHandle didn't return the correct memory handle\n");
/* Check that we can't discard locked memory */
mem2b=LocalDiscard(mem2a);
ok(mem2b==NULL,"Discarded memory we shouldn't have");
ok(mem2b==NULL,"Discarded memory we shouldn't have\n");
SetLastError(NO_ERROR);
ok(!LocalUnlock(mem2a) && GetLastError()==NO_ERROR, "LocalUnlock Failed.");
ok(!LocalUnlock(mem2a) && GetLastError()==NO_ERROR, "LocalUnlock Failed\n");
}
}
if(mem1) {
ok(LocalFree(mem1)==NULL,"LocalFree failed");
ok(LocalFree(mem1)==NULL,"LocalFree failed\n");
}
if(mem2a) {
ok(LocalFree(mem2a)==NULL,"LocalFree failed");
ok(LocalFree(mem2a)==NULL,"LocalFree failed\n");
} else {
ok(LocalFree(mem2)==NULL,"LocalFree failed");
ok(LocalFree(mem2)==NULL,"LocalFree failed\n");
}
}
@ -370,14 +370,14 @@ static void test_Virtual(void)
/* Retrieve the page size for this system */
sysInfo.dwPageSize=0;
GetSystemInfo(&sysInfo);
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size");
ok(sysInfo.dwPageSize>0,"GetSystemInfo should return a valid page size\n");
/* Choose a reasonable allocation size */
memchunk=10*sysInfo.dwPageSize;
/* Check that a normal alloc works */
mem1=VirtualAlloc(NULL,memchunk,MEM_COMMIT,PAGE_READWRITE);
ok(mem1!=NULL,"VirtualAlloc failed");
ok(mem1!=NULL,"VirtualAlloc failed\n");
if(mem1) {
/* check that memory is initialized to 0 */
error=0;
@ -386,7 +386,7 @@ static void test_Virtual(void)
error=1;
}
}
ok(!error,"VirtualAlloc did not initialize memory to '0's");
ok(!error,"VirtualAlloc did not initialize memory to '0's\n");
/* Check that we can read/write to memory */
error=0;
for(i=0;i<memchunk;i+=100) {
@ -395,9 +395,9 @@ static void test_Virtual(void)
error=1;
}
}
ok(!error,"Virtual memory was not writable");
ok(!error,"Virtual memory was not writable\n");
}
ok(VirtualFree(mem1,0,MEM_RELEASE),"VirtualFree failed");
ok(VirtualFree(mem1,0,MEM_RELEASE),"VirtualFree failed\n");
}
START_TEST(alloc)
{

View File

@ -37,16 +37,16 @@
CONSOLE_SCREEN_BUFFER_INFO __sbi; \
BOOL expect = GetConsoleScreenBufferInfo((hCon), &__sbi) && \
__sbi.dwCursorPosition.X == (c).X && __sbi.dwCursorPosition.Y == (c).Y; \
ok(expect, "Expected cursor at (%d,%d), got (%d,%d)", \
ok(expect, "Expected cursor at (%d,%d), got (%d,%d)\n", \
(c).X, (c).Y, __sbi.dwCursorPosition.X, __sbi.dwCursorPosition.Y); \
} while (0)
#define okCHAR(hCon, c, ch, attr) do { \
char __ch; WORD __attr; DWORD __len; BOOL expect; \
expect = ReadConsoleOutputCharacter((hCon), &__ch, 1, (c), &__len) == 1 && __len == 1 && __ch == (ch); \
ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x", (c).X, (c).Y, (ch), (ch), __ch, __ch); \
ok(expect, "At (%d,%d): expecting char '%c'/%02x got '%c'/%02x\n", (c).X, (c).Y, (ch), (ch), __ch, __ch); \
expect = ReadConsoleOutputAttribute((hCon), &__attr, 1, (c), &__len) == 1 && __len == 1 && __attr == (attr); \
ok(expect, "At (%d,%d): expecting attr %04x got %04x", (c).X, (c).Y, (attr), __attr); \
ok(expect, "At (%d,%d): expecting attr %04x got %04x\n", (c).X, (c).Y, (attr), __attr); \
} while (0)
/* FIXME: this could be optimized on a speed point of view */
@ -73,41 +73,41 @@ static void testCursor(HANDLE hCon, COORD sbSize)
COORD c;
c.X = c.Y = 0;
ok(SetConsoleCursorPosition(0, c) == 0, "No handle");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu",
ok(SetConsoleCursorPosition(0, c) == 0, "No handle\n");
ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_HANDLE, GetLastError());
c.X = c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n");
okCURSOR(hCon, c);
c.X = sbSize.X - 1;
c.Y = sbSize.Y - 1;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in lower-right");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in lower-right\n");
okCURSOR(hCon, c);
c.X = sbSize.X;
c.Y = sbSize.Y - 1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu",
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = sbSize.X - 1;
c.Y = sbSize.Y;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu",
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = -1;
c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu",
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError());
c.X = 0;
c.Y = -1;
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu",
ok(SetConsoleCursorPosition(hCon, c) == 0, "Cursor is outside\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError: expecting %u got %lu\n",
ERROR_INVALID_PARAMETER, GetLastError());
}
@ -120,9 +120,9 @@ static void testWriteSimple(HANDLE hCon, COORD sbSize)
/* single line write */
c.X = c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (c.X = 0; c.X < mylen; c.X++)
{
@ -142,13 +142,13 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode & ~(ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT)),
"clearing wrap at EOL & processed output");
"clearing wrap at EOL & processed output\n");
/* write line, wrapping disabled, buffer exceeds sb width */
c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = mylen - 3; p < mylen; p++)
{
@ -165,9 +165,9 @@ static void testWriteNotWrappedNotProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end on end of line */
c.X = sbSize.X - mylen; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = 0; p < mylen; p++)
{
@ -193,13 +193,13 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, (mode | ENABLE_PROCESSED_OUTPUT) & ~ENABLE_WRAP_AT_EOL_OUTPUT),
"clearing wrap at EOL & setting processed output");
"clearing wrap at EOL & setting processed output\n");
/* write line, wrapping disabled, buffer exceeds sb width */
c.X = sbSize.X - 5; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-5");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-5\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (c.X = sbSize.X - 5; c.X < sbSize.X - 1; c.X++)
{
@ -219,9 +219,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end on end of line */
c.X = sbSize.X - 4; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (c.X = sbSize.X - 4; c.X < sbSize.X; c.X++)
{
@ -239,9 +239,9 @@ static void testWriteNotWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping disabled, strings end after end of line */
c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-4\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = mylen2 - 3; p < mylen2; p++)
{
@ -268,13 +268,13 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon,(mode | ENABLE_WRAP_AT_EOL_OUTPUT) & ~(ENABLE_PROCESSED_OUTPUT)),
"setting wrap at EOL & clearing processed output");
"setting wrap at EOL & clearing processed output\n");
/* write line, wrapping enabled, buffer doesn't exceed sb width */
c.X = sbSize.X - 9; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = 0; p < mylen; p++)
{
@ -288,9 +288,9 @@ static void testWriteWrappedNotProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping enabled, buffer does exceed sb width */
c.X = sbSize.X - 3; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
c.Y = 0;
for (p = 0; p < 3; p++)
{
@ -319,13 +319,13 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
int p;
ok(GetConsoleMode(hCon, &mode) && SetConsoleMode(hCon, mode | (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)),
"setting wrap at EOL & processed output");
"setting wrap at EOL & processed output\n");
/* write line, wrapping enabled, buffer doesn't exceed sb width */
c.X = sbSize.X - 9; c.Y = 0;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-9\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
for (p = 0; p < 4; p++)
{
c.X = sbSize.X - 9 + p;
@ -344,9 +344,9 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
/* write line, wrapping enabled, buffer does exceed sb width */
c.X = sbSize.X - 3; c.Y = 2;
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3");
ok(SetConsoleCursorPosition(hCon, c) != 0, "Cursor in upper-left-3\n");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole");
ok(WriteConsole(hCon, mytest, mylen, &len, NULL) != 0 && len == mylen, "WriteConsole\n");
for (p = 0; p < 3; p++)
{
c.X = sbSize.X - 3 + p;
@ -370,7 +370,7 @@ static void testWriteWrappedProcessed(HANDLE hCon, COORD sbSize)
static void testWrite(HANDLE hCon, COORD sbSize)
{
/* FIXME: should in fact insure that the sb is at least 10 character wide */
ok(SetConsoleTextAttribute(hCon, TEST_ATTRIB), "Setting default text color");
ok(SetConsoleTextAttribute(hCon, TEST_ATTRIB), "Setting default text color\n");
resetContent(hCon, sbSize, FALSE);
testWriteSimple(hCon, sbSize);
resetContent(hCon, sbSize, FALSE);
@ -413,7 +413,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = 0;
clip.Bottom = sbSize.Y - 1;
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB");
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{
@ -448,7 +448,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = 0;
clip.Bottom = sbSize.Y - 1;
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB");
ok(ScrollConsoleScreenBuffer(hCon, &scroll, NULL, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{
@ -482,7 +482,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = H / 2;
clip.Bottom = min(H + H / 2, sbSize.Y - 1);
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB");
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{
@ -517,7 +517,7 @@ static void testScroll(HANDLE hCon, COORD sbSize)
clip.Top = H / 2;
clip.Bottom = min(H + H / 2, sbSize.Y - 1);
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB");
ok(ScrollConsoleScreenBuffer(hCon, &scroll, &clip, dst, &ci), "Scrolling SB\n");
for (c.Y = 0; c.Y < sbSize.Y; c.Y++)
{
@ -562,10 +562,10 @@ START_TEST(console)
hConOut = CreateFileA("CONOUT$", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0);
}
/* now verify everything's ok */
ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn");
ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut");
ok(hConIn != INVALID_HANDLE_VALUE, "Opening ConIn\n");
ok(hConOut != INVALID_HANDLE_VALUE, "Opening ConOut\n");
ok(ret = GetConsoleScreenBufferInfo(hConOut, &sbi), "Getting sb info");
ok(ret = GetConsoleScreenBufferInfo(hConOut, &sbi), "Getting sb info\n");
if (!ret) return;
/* Non interactive tests */

View File

@ -34,23 +34,23 @@ static void test_GetWindowsDirectoryA(void)
char buf[MAX_PATH];
len_with_null = GetWindowsDirectoryA(NULL, 0);
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH");
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyA(buf, "foo");
len_with_null = GetWindowsDirectoryA(buf, 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer");
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
lstrcpyA(buf, "foo");
len = GetWindowsDirectoryA(buf, len_with_null - 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d",
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null);
lstrcpyA(buf, "foo");
len = GetWindowsDirectoryA(buf, len_with_null);
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer");
ok(len == strlen(buf), "returned length should be equal to the length of string");
ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d",
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
ok(len == strlen(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetWindowsDirectoryA returned %d, expected %d\n",
len, len_with_null-1);
}
@ -63,25 +63,25 @@ static void test_GetWindowsDirectoryW(void)
len_with_null = GetWindowsDirectoryW(NULL, 0);
if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH");
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null);
lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, len_with_null - 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null);
lstrcpyW(buf, fooW);
len = GetWindowsDirectoryW(buf, len_with_null);
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string");
ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetWindowsDirectoryW returned %d, expected %d\n",
len, len_with_null-1);
}
@ -95,25 +95,25 @@ static void test_GetSystemDirectoryA(void)
char buf[MAX_PATH];
len_with_null = GetSystemDirectoryA(NULL, 0);
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH");
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d",
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
len, len_with_null);
lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, len_with_null - 1);
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d",
ok(lstrcmpA(buf, "foo") == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryA returned %d, expected %d\n",
len, len_with_null);
lstrcpyA(buf, "foo");
len = GetSystemDirectoryA(buf, len_with_null);
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer");
ok(len == strlen(buf), "returned length should be equal to the length of string");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d",
ok(lstrcmpA(buf, "foo") != 0, "should touch the buffer\n");
ok(len == strlen(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null-1);
}
@ -126,25 +126,25 @@ static void test_GetSystemDirectoryW(void)
len_with_null = GetSystemDirectoryW(NULL, 0);
if (len_with_null==0 && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH");
ok(len_with_null <= MAX_PATH, "should fit into MAX_PATH\n");
lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null);
lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, len_with_null - 1);
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) == 0, "should not touch the buffer\n");
ok(len == len_with_null, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null);
lstrcpyW(buf, fooW);
len = GetSystemDirectoryW(buf, len_with_null);
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d",
ok(lstrcmpW(buf, fooW) != 0, "should touch the buffer\n");
ok(len == lstrlenW(buf), "returned length should be equal to the length of string\n");
ok(len == len_with_null-1, "GetSystemDirectoryW returned %d, expected %d\n",
len, len_with_null-1);
}
@ -156,55 +156,55 @@ static void test_CreateDirectoryA(void)
ret = CreateDirectoryA(NULL, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_PATH_NOT_FOUND ||
GetLastError() == ERROR_INVALID_PARAMETER),
"CreateDirectoryA(NULL,NULL): ret=%d error=%ld",ret,GetLastError());
"CreateDirectoryA(NULL,NULL): ret=%d error=%ld\n",ret,GetLastError());
ret = CreateDirectoryA("", NULL);
ok(ret == FALSE && (GetLastError() == ERROR_BAD_PATHNAME ||
GetLastError() == ERROR_PATH_NOT_FOUND),
"CreateDirectoryA(\"\",NULL): ret=%d error=%ld",ret,GetLastError());
"CreateDirectoryA(\"\",NULL): ret=%d error=%ld\n",ret,GetLastError());
ret = GetSystemDirectoryA(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH");
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
ret = SetCurrentDirectoryA(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory");
ok(ret == TRUE, "could not chdir to the System directory\n");
ret = CreateDirectoryA(".", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = CreateDirectoryA("..", NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
GetTempPathA(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && (GetLastError() == ERROR_ALREADY_EXISTS ||
GetLastError() == ERROR_ACCESS_DENIED),
"CreateDirectoryA(drive_root): ret=%d error=%ld",ret,GetLastError());
"CreateDirectoryA(drive_root): ret=%d error=%ld\n",ret,GetLastError());
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryA should always succeed");
ok(ret == TRUE, "CreateDirectoryA should always succeed\n");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE, "RemoveDirectoryA should always succeed");
ok(ret == TRUE, "RemoveDirectoryA should always succeed\n");
todo_wine {
lstrcatA(tmpdir, "?");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld",
"CreateDirectoryA with ? wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryA(tmpdir);
tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld",
"CreateDirectoryA with * wildcard name should fail, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryA(tmpdir);
}
@ -223,51 +223,51 @@ static void test_CreateDirectoryW(void)
ret = CreateDirectoryW(NULL, NULL);
if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path");
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create NULL path\n");
ret = CreateDirectoryW(empty_strW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path");
ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, "should not create empty path\n");
ret = GetSystemDirectoryW(tmpdir, MAX_PATH);
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH");
ok(ret < MAX_PATH, "System directory should fit into MAX_PATH\n");
ret = SetCurrentDirectoryW(tmpdir);
ok(ret == TRUE, "could not chdir to the System directory");
ok(ret == TRUE, "could not chdir to the System directory\n");
ret = CreateDirectoryW(dotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = CreateDirectoryW(dotdotW, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
GetTempPathW(MAX_PATH, tmpdir);
tmpdir[3] = 0; /* truncate the path */
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root");
ok(ret == FALSE && GetLastError() == ERROR_ACCESS_DENIED, "should deny access to the drive root\n");
GetTempPathW(MAX_PATH, tmpdir);
lstrcatW(tmpdir, tmp_dir_name);
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryW should always succeed");
ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path");
ok(ret == FALSE && GetLastError() == ERROR_ALREADY_EXISTS, "should not create existing path\n");
ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed");
ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
todo_wine {
lstrcatW(tmpdir, questionW);
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld",
"CreateDirectoryW with ? wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir);
tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = CreateDirectoryW(tmpdir, NULL);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld",
"CreateDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
ret = RemoveDirectoryW(tmpdir);
}
@ -281,22 +281,22 @@ static void test_RemoveDirectoryA(void)
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
ret = CreateDirectoryA(tmpdir, NULL);
ok(ret == TRUE, "CreateDirectoryA should always succeed");
ok(ret == TRUE, "CreateDirectoryA should always succeed\n");
ret = RemoveDirectoryA(tmpdir);
ok(ret == TRUE, "RemoveDirectoryA should always succeed");
ok(ret == TRUE, "RemoveDirectoryA should always succeed\n");
todo_wine {
lstrcatA(tmpdir, "?");
ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryA with ? wildcard name should fail with error 183, ret=%s error=%ld",
"RemoveDirectoryA with ? wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
tmpdir[lstrlenA(tmpdir) - 1] = '*';
ret = RemoveDirectoryA(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryA with * wildcard name should fail with error 183, ret=%s error=%ld",
"RemoveDirectoryA with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
}
}
@ -314,22 +314,22 @@ static void test_RemoveDirectoryW(void)
if (!ret && GetLastError()==ERROR_CALL_NOT_IMPLEMENTED)
return;
ok(ret == TRUE, "CreateDirectoryW should always succeed");
ok(ret == TRUE, "CreateDirectoryW should always succeed\n");
ret = RemoveDirectoryW(tmpdir);
ok(ret == TRUE, "RemoveDirectoryW should always succeed");
ok(ret == TRUE, "RemoveDirectoryW should always succeed\n");
todo_wine {
lstrcatW(tmpdir, questionW);
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld",
"RemoveDirectoryW with wildcard should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
tmpdir[lstrlenW(tmpdir) - 1] = '*';
ret = RemoveDirectoryW(tmpdir);
ok(ret == FALSE && GetLastError() == ERROR_INVALID_NAME,
"RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld",
"RemoveDirectoryW with * wildcard name should fail with error 183, ret=%s error=%ld\n",
ret ? " True" : "False", GetLastError());
}

View File

@ -83,20 +83,20 @@ void UuidConversionAndComparison(void) {
} else {
PUuid2 = NULL;
}
ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality" );
ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality\n" );
}
/* Uuid to String to Uuid (char) */
for (i1 = 0; i1 < 10; i1++) {
Uuid1 = Uuid_Table[i1];
ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy" );
ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform" );
ok( (UuidToStringA(&Uuid1, (unsigned char**)&str) == RPC_S_OK), "Simple UUID->String copy\n" );
ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String\n" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform\n" );
/* invalid uuid tests -- size of valid UUID string=36 */
for (i2 = 0; i2 < 36; i2++) {
x = str[i2];
str[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String" );
ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String\n" );
str[i2] = x; /* change it back so remaining tests are interesting. */
}
}
@ -109,14 +109,14 @@ void UuidConversionAndComparison(void) {
/* Must be Win9x (no Unicode support), skip the tests */
break;
}
ok( (rslt == RPC_S_OK), "Simple UUID->WString copy" );
ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform" );
ok( (rslt == RPC_S_OK), "Simple UUID->WString copy\n" );
ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String\n" );
ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform\n" );
/* invalid uuid tests -- size of valid UUID string=36 */
for (i2 = 0; i2 < 36; i2++) {
wx = wstr[i2];
wstr[i2] = 'g'; /* whatever, but "g" is a good boundary condition */
ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString" );
ok( (UuidFromStringW(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString\n" );
wstr[i2] = wx; /* change it back so remaining tests are interesting. */
}
}

View File

@ -36,11 +36,9 @@ void createTestFile(CHAR *name)
{
HANDLE file;
DWORD written;
CHAR msg[MAX_PATH];
file = CreateFileA(name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
sprintf(msg, "Failure to open file %s", name);
ok(file != INVALID_HANDLE_VALUE, msg);
ok(file != INVALID_HANDLE_VALUE, "Failure to open file %s\n", name);
WriteFile(file, name, strlen(name), &written, NULL);
WriteFile(file, "\n", strlen("\n"), &written, NULL);
CloseHandle(file);
@ -119,33 +117,33 @@ void test_delete(void)
shfo.hNameMappings = NULL;
shfo.lpszProgressTitle = NULL;
ok(!SHFileOperationA(&shfo), "Deletion was successful");
ok(file_exists(".\\test4.txt"), "Directory should not be removed");
ok(!file_exists(".\\test1.txt"), "File should be removed");
ok(!SHFileOperationA(&shfo), "Deletion was successful\n");
ok(file_exists(".\\test4.txt"), "Directory should not be removed\n");
ok(!file_exists(".\\test1.txt"), "File should be removed\n");
ok(!SHFileOperationA(&shfo), "Directory exists, but is not removed");
ok(file_exists(".\\test4.txt"), "Directory should not be removed");
ok(!SHFileOperationA(&shfo), "Directory exists, but is not removed\n");
ok(file_exists(".\\test4.txt"), "Directory should not be removed\n");
shfo.fFlags = FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI;
ok(!SHFileOperationA(&shfo), "Directory removed");
ok(!file_exists(".\\test4.txt"), "Directory should be removed");
ok(!SHFileOperationA(&shfo), "Directory removed\n");
ok(!file_exists(".\\test4.txt"), "Directory should be removed\n");
ok(!SHFileOperationA(&shfo), "The requested file does not exist");
ok(!SHFileOperationA(&shfo), "The requested file does not exist\n");
init_shfo_tests();
sprintf(buf, "%s\\%s", CURR_DIR, "test4.txt");
buf[strlen(buf) + 1] = '\0';
ok(MoveFileA(".\\test1.txt", ".\\test4.txt\\test1.txt"), "Fill the subdirectory");
ok(!SHFileOperationA(&shfo), "Directory removed");
ok(!file_exists(".\\test4.txt"), "Directory is removed");
ok(MoveFileA(".\\test1.txt", ".\\test4.txt\\test1.txt"), "Fill the subdirectory\n");
ok(!SHFileOperationA(&shfo), "Directory removed\n");
ok(!file_exists(".\\test4.txt"), "Directory is removed\n");
init_shfo_tests();
shfo.pFrom = ".\\test1.txt\0.\\test4.txt\0";
ok(!SHFileOperationA(&shfo), "Directory and a file removed");
ok(!file_exists(".\\test1.txt"), "The file should be removed");
ok(!file_exists(".\\test4.txt"), "Directory should be removed");
ok(file_exists(".\\test2.txt"), "This file should not be removed");
ok(!SHFileOperationA(&shfo), "Directory and a file removed\n");
ok(!file_exists(".\\test1.txt"), "The file should be removed\n");
ok(!file_exists(".\\test4.txt"), "Directory should be removed\n");
ok(file_exists(".\\test2.txt"), "This file should not be removed\n");
}
/* tests the FO_RENAME action */
@ -167,19 +165,19 @@ void test_rename()
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0");
ok(SHFileOperationA(&shfo), "File is not renamed moving to other directory "
"when specifying directory name only");
ok(file_exists(".\\test1.txt"), "The file is not removed");
"when specifying directory name only\n");
ok(file_exists(".\\test1.txt"), "The file is not removed\n");
set_curr_dir_path(from, "test3.txt\0");
set_curr_dir_path(to, "test4.txt\\test1.txt\0");
ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is renamed");
ok(!SHFileOperationA(&shfo), "File is renamed moving to other directory\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is renamed\n");
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
retval = SHFileOperationA(&shfo); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified ");
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx\n", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified\n");
memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
shfo2.fFlags |= FOF_MULTIDESTFILES;
@ -187,26 +185,26 @@ void test_rename()
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
retval = SHFileOperationA(&shfo2); /* W98 returns 0, W2K and newer returns ERROR_GEN_FAILURE, both do nothing */
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified ");
ok(!retval || retval == ERROR_GEN_FAILURE, "Can't rename many files, retval = %lx\n", retval);
ok(file_exists(".\\test1.txt"), "The file is not renamed - many files are specified\n");
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Rename file");
ok(!file_exists(".\\test1.txt"), "The file is renamed");
ok(file_exists(".\\test6.txt"), "The file is renamed");
ok(!SHFileOperationA(&shfo), "Rename file\n");
ok(!file_exists(".\\test1.txt"), "The file is renamed\n");
ok(file_exists(".\\test6.txt"), "The file is renamed\n");
set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test1.txt\0");
ok(!SHFileOperationA(&shfo), "Rename file back");
ok(!SHFileOperationA(&shfo), "Rename file back\n");
set_curr_dir_path(from, "test4.txt\0");
set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Rename dir");
ok(!file_exists(".\\test4.txt"), "The dir is renamed");
ok(file_exists(".\\test6.txt"), "The dir is renamed ");
ok(!SHFileOperationA(&shfo), "Rename dir\n");
ok(!file_exists(".\\test4.txt"), "The dir is renamed\n");
ok(file_exists(".\\test6.txt"), "The dir is renamed\n");
set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Rename dir back");
ok(!SHFileOperationA(&shfo), "Rename dir back\n");
}
/* tests the FO_COPY action */
@ -228,18 +226,18 @@ void test_copy(void)
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(SHFileOperationA(&shfo), "Can't copy many files");
ok(SHFileOperationA(&shfo), "Can't copy many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are "
"specified as a target");
"specified as a target\n");
memcpy(&shfo2, &shfo, sizeof(SHFILEOPSTRUCTA));
shfo2.fFlags |= FOF_MULTIDESTFILES;
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(!SHFileOperationA(&shfo2), "Can't copy many files");
ok(!SHFileOperationA(&shfo2), "Can't copy many files\n");
ok(file_exists(".\\test6.txt"), "The file is copied - many files are "
"specified as a target");
"specified as a target\n");
DeleteFileA(".\\test6.txt");
DeleteFileA(".\\test7.txt");
RemoveDirectoryA(".\\test8.txt");
@ -247,41 +245,41 @@ void test_copy(void)
/* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0");
ok(SHFileOperationA(&shfo2), "Can't copy many files");
ok(SHFileOperationA(&shfo2), "Can't copy many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not copied - many files are "
"specified as a target");
"specified as a target\n");
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is copied");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are copied recursively\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is copied\n");
set_curr_dir_path(from, "test?.txt\0");
set_curr_dir_path(to, "testdir2\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet");
ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory ");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is copied");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files and directories are copied to directory\n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is copied\n");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is copied\n");
clean_after_shfo_tests();
init_shfo_tests();
shfo.fFlags |= FOF_FILESONLY;
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory ");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is copied");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory\n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is copied\n");
clean_after_shfo_tests();
init_shfo_tests();
set_curr_dir_path(from, "test1.txt\0test2.txt\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory ");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is copied");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet\n");
ok(!SHFileOperationA(&shfo), "Files are copied to other directory \n");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is copied\n");
clean_after_shfo_tests();
/* Copying multiple files with one not existing as source, fails the
@ -289,19 +287,19 @@ void test_copy(void)
init_shfo_tests();
tmp_flags = shfo.fFlags;
set_curr_dir_path(from, "test1.txt\0test10.txt\0test2.txt\0");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is not copied yet\n");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not copied yet\n");
retval = SHFileOperationA(&shfo);
if (!retval)
/* Win 95/NT returns success but copies only the files up to the non-existent source */
ok(file_exists(".\\testdir2\\test1.txt"), "The file is not copied");
ok(file_exists(".\\testdir2\\test1.txt"), "The file is not copied\n");
else
{
/* Win 98/ME/2K/XP fail the entire operation with return code 1026 if one source file does not exist */
ok(retval == 1026, "Files are copied to other directory ");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is copied");
ok(retval == 1026, "Files are copied to other directory\n");
ok(!file_exists(".\\testdir2\\test1.txt"), "The file is copied\n");
}
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is copied");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is copied\n");
shfo.fFlags = tmp_flags;
}
@ -322,17 +320,17 @@ void test_move(void)
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved");
ok(!SHFileOperationA(&shfo), "Prepare test to check how directories are moved recursively\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved\n");
set_curr_dir_path(from, "test?.txt\0");
set_curr_dir_path(to, "testdir2\0");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not moved yet");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not moved yet");
ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory ");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is moved");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is moved");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved");
ok(!file_exists(".\\testdir2\\test2.txt"), "The file is not moved yet\n");
ok(!file_exists(".\\testdir2\\test4.txt"), "The directory is not moved yet\n");
ok(!SHFileOperationA(&shfo), "Files and directories are moved to directory\n");
ok(file_exists(".\\testdir2\\test2.txt"), "The file is moved\n");
ok(file_exists(".\\testdir2\\test4.txt"), "The directory is moved\n");
ok(file_exists(".\\testdir2\\test4.txt\\test1.txt"), "The file in subdirectory is moved\n");
clean_after_shfo_tests();
init_shfo_tests();
@ -342,9 +340,9 @@ void test_move(void)
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(!SHFileOperationA(&shfo2), "Move many files");
ok(!SHFileOperationA(&shfo2), "Move many files\n");
ok(file_exists(".\\test6.txt"), "The file is moved - many files are "
"specified as a target");
"specified as a target\n");
DeleteFileA(".\\test6.txt");
DeleteFileA(".\\test7.txt");
RemoveDirectoryA(".\\test8.txt");
@ -354,40 +352,40 @@ void test_move(void)
/* number of sources do not correspond to number of targets */
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0");
ok(SHFileOperationA(&shfo2), "Can't move many files");
ok(SHFileOperationA(&shfo2), "Can't move many files\n");
ok(!file_exists(".\\test6.txt"), "The file is not moved - many files are "
"specified as a target");
"specified as a target\n");
init_shfo_tests();
set_curr_dir_path(from, "test3.txt\0");
set_curr_dir_path(to, "test4.txt\\test1.txt\0");
ok(!SHFileOperationA(&shfo), "File is moved moving to other directory");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved");
ok(!SHFileOperationA(&shfo), "File is moved moving to other directory\n");
ok(file_exists(".\\test4.txt\\test1.txt"), "The file is moved\n");
set_curr_dir_path(from, "test1.txt\0test2.txt\0test4.txt\0");
set_curr_dir_path(to, "test6.txt\0test7.txt\0test8.txt\0");
ok(SHFileOperationA(&shfo), "Can not move many files");
ok(file_exists(".\\test1.txt"), "The file is not moved. Many files are specified ");
ok(file_exists(".\\test4.txt"), "The directory not is moved. Many files are specified ");
ok(SHFileOperationA(&shfo), "Can not move many files\n");
ok(file_exists(".\\test1.txt"), "The file is not moved. Many files are specified\n");
ok(file_exists(".\\test4.txt"), "The directory not is moved. Many files are specified\n");
set_curr_dir_path(from, "test1.txt\0");
set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Move file");
ok(!file_exists(".\\test1.txt"), "The file is moved");
ok(file_exists(".\\test6.txt"), "The file is moved ");
ok(!SHFileOperationA(&shfo), "Move file\n");
ok(!file_exists(".\\test1.txt"), "The file is moved\n");
ok(file_exists(".\\test6.txt"), "The file is moved\n");
set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test1.txt\0");
ok(!SHFileOperationA(&shfo), "Move file back");
ok(!SHFileOperationA(&shfo), "Move file back\n");
set_curr_dir_path(from, "test4.txt\0");
set_curr_dir_path(to, "test6.txt\0");
ok(!SHFileOperationA(&shfo), "Move dir");
ok(!file_exists(".\\test4.txt"), "The dir is moved");
ok(file_exists(".\\test6.txt"), "The dir is moved ");
ok(!SHFileOperationA(&shfo), "Move dir\n");
ok(!file_exists(".\\test4.txt"), "The dir is moved\n");
ok(file_exists(".\\test6.txt"), "The dir is moved\n");
set_curr_dir_path(from, "test6.txt\0");
set_curr_dir_path(to, "test4.txt\0");
ok(!SHFileOperationA(&shfo), "Move dir back");
ok(!SHFileOperationA(&shfo), "Move dir back\n");
}
START_TEST(shlfileop)