More tests in file.c

Jakob Eriksson jakob at vmlinux.org
Fri May 3 09:40:19 CDT 2002



Changelog:
* added a few tests to file.c  -  some of them fails! Don't know if
  they should. Would appreciate if someone verified that I'm on track
  before I start hacking around in the Wine code to make the tests pass.

------------------------------------------------------------------------

? kernel.spec.c
? patch.diff
Index: tests/file.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/file.c,v
retrieving revision 1.1
diff -u -r1.1 file.c
--- tests/file.c	29 Apr 2002 17:14:50 -0000	1.1
+++ tests/file.c	3 May 2002 14:12:42 -0000
@@ -48,8 +48,7 @@
     UINT i;
 
     filehandle = _lcreat( filename, 0 );
-
-    ok( HFILE_ERROR != filehandle, "_lcreat complains." );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
 
     ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." );
 
@@ -89,8 +88,7 @@
     char checksum[1];
 
     filehandle = _lcreat( filename, 0 );
-
-    ok( HFILE_ERROR != filehandle, "_lcreat complains." );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
 
     ok( HFILE_ERROR != _hwrite( filehandle, "", 0 ), "_hwrite complains." );
 
@@ -161,8 +159,7 @@
     HFILE filehandle;
 
     filehandle = _lcreat( filename, 0 );
-
-    ok( HFILE_ERROR != filehandle, "_lcreat complains." );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
 
     ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." );
 
@@ -172,13 +169,81 @@
 
     ok( HFILE_ERROR == _lclose(filehandle), "_lclose should whine about this." );
 
-    ok( DeleteFileA( filename ) != 0, "DeleteFile complains." );
+    ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." );
 }
 
 
+static void test__lcreat( void )
+{
+    HFILE filehandle;
+    char buffer[10000];
+    WIN32_FIND_DATAA search_results;
+
+    filehandle = _lcreat( filename, 0 );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
+
+    ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." );
+
+    ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains." );
+
+    ok( _hread( filehandle, buffer, strlen( sillytext ) ) ==  strlen( sillytext ), "erratic _hread return value." );
+
+    ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains." );
+
+    ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file" );
+
+    ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." );
+    
+
+    filehandle = _lcreat( filename, 1 );
+    ok( HFILE_ERROR != filehandle, "couldn't create file!?" );
+
+    ok( HFILE_ERROR == _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite shouldn't succeed writing." );
+
+    ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains." );
+
+    ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file" );
+
+    ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." );
+
+
+    filehandle = _lcreat( filename, 2 );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
+
+    ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." );
+
+    ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains." );
+
+    ok( _hread( filehandle, buffer, strlen( sillytext ) ) ==  strlen( sillytext ), "erratic _hread return value." );
+
+    ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains." );
+
+    ok( INVALID_HANDLE_VALUE == FindFirstFileA( filename, &search_results ), "should NOT be able to find file" );
+
+    ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." );
+    
+
+    filehandle = _lcreat( filename, 4 );
+    ok( HFILE_ERROR != filehandle, "couldn't create file. Wrong permissions on directory?" );
+
+    ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite complains." );
+
+    ok( 0 == _llseek( filehandle, 0, FILE_BEGIN ), "_llseek complains." );
+
+    ok( _hread( filehandle, buffer, strlen( sillytext ) ) ==  strlen( sillytext ), "erratic _hread return value." );
+
+    ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains." );
+
+    ok( INVALID_HANDLE_VALUE == FindFirstFileA( filename, &search_results ), "should NOT be able to find file" );
+
+    ok( DeleteFileA( filename ) != 0, "DeleteFileA complains." );
+}
+
 START_TEST(file)
 {
     test__hread(  );
     test__hwrite(  );
     test__lclose(  );
+    test__lcreat(  );
 }
+



More information about the wine-patches mailing list