(file) Return to cabinet_fdi.c CVS log (file) (dir) Up to [RizwankCVS] / group3 / wine / dlls / cabinet / tests

  1 rizwank 1.1 /*
  2              * Unit test suite for cabinet.dll - FDI functions
  3              *
  4              * Copyright 2004 Rizwan Kassim, Dan Kegel
  5              *
  6              * This library is free software; you can redistribute it and/or
  7              * modify it under the terms of the GNU Lesser General Public
  8              * License as published by the Free Software Foundation; either
  9              * version 2.1 of the License, or (at your option) any later version.
 10              *
 11              * This library is distributed in the hope that it will be useful,
 12              * but WITHOUT ANY WARRANTY; without even the implied warranty of
 13              * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 14              * Lesser General Public License for more details.
 15              *
 16              * You should have received a copy of the GNU Lesser General Public
 17              * License along with this library; if not, write to the Free Software
 18              * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 19              */
 20             
 21             
 22 rizwank 1.1 #include <stdlib.h>
 23             
 24             #ifndef STANDALONE
 25             #include <wine/test.h>
 26             #define ok2 ok
 27             #else
 28             /* To build outside Wine tree, compile with cl -DSTANDALONE -D_X86_ cabinet_fdi.c FDI.lib 
 29               These are only called if standalone are used, defining ok and START_TEST, which would normally be declared in winetree */
 30             #include <assert.h> 
 31             #include <stdio.h>
 32             #define START_TEST(name) main(int argc, char **argv)
 33             #define ok(condition, msg)       \
 34             	do { if(!(condition)) {  \
 35             		fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__); \
 36             		exit(1);         \
 37             	} } while(0)
 38             #define ok2(condition, msg, arg) \
 39                     do { if(!(condition)) {  \
 40             		fprintf(stderr,"failed at %d, msg:" msg "\n",__LINE__, arg); \
 41             		exit(1);         \
 42             	} } while(0)
 43 rizwank 1.1 #define todo_wine
 44             #endif 
 45             
 46             
 47             #include <winerror.h>
 48             #include <fdi.h>
 49             
 50             /*	To do in FDI:				-from wine/include/fdi.h
 51             	FDICreate
 52             		Memory Allocation		-FNALLOC(cb)
 53             		Memory Free				-FNFREE(pv)
 54             		File Open				-FNOPEN(pszFile,oflag,pmode)
 55             		File Read				-FNREAD(hf, pv, cb)
 56             		File Write				-FNWRITE(hf, pv, cb)
 57             		File Close				-FNCLOSE(hf)
 58             		File Seek				-FNSEEK(hf,dist,seektype)
 59             		Error Structure
 60             	FDIlsCabinet
 61             		FDICabinetInfo Structure
 62             	FDICopy
 63             		Notification function
 64 rizwank 1.1 		Decryption function
 65             	FDIDestroy
 66             */
 67             
 68 rizwank 1.3 /* Currently dummy function pointers */
 69 rizwank 1.1 
 70 rizwank 1.3 FNALLOC(dummy_alloc) {
 71              	printf("FNALLOC just called with %d\n",cb);
 72             	return 0;
 73             }
 74             
 75             FNFREE(dummy_free) {
 76             	printf("FNFREE just called with %d\n",pv);
 77             	return;
 78             }
 79             
 80             FNOPEN(dummy_open) {
 81             	 printf("FNOPEN just called with %d, %d, %d\n",pszFile, oflag, pmode);
 82             	return 0;
 83             }
 84             
 85             FNREAD(dummy_read) {
 86             /*	 printf("FNREAD just called with %d, %d, %d\n",hf, pv, cb);
 87             	 return void;
 88             */	return 0;
 89             }
 90             	
 91 rizwank 1.3 FNWRITE(dummy_write) {
 92             /*	 printf("FNWRITE just called with %d, %d, %d\n",hf, pv, cb);
 93             	 return void;
 94             */	return 0;
 95             }
 96             
 97             
 98             FNCLOSE(dummy_close) {
 99             /*	 printf("FNCLOSE just called with %d\n",hf);	
100             	return void;
101             */	return 0;
102             }
103 rizwank 1.1 
104 rizwank 1.3 FNSEEK(dummy_seek) {
105             /*	 printf("FNSEEK just called with %d, %d, %d\n",hf, dist, seektype);	
106             	return void;
107             */	return 0;
108             }
109             
110             static void TestDestroy(void) {
111             	/* Only two things to check in FDIDestroy
112             	   1=> Does it return T if its passed an hfdi
113             	   2=> Does it return F if its passed a non hfdi
114             	*/
115             	
116             	ok( 0 == FDIDestroy(0), "Return true incorrectly in TestDestroy()!\n");
117             	/*
118             		TODO : check if its passed an hfdi
119             		*/
120             }
121 rizwank 1.1 
122             
123             START_TEST(paths)
124             {
125 rizwank 1.2 	/*
126             	TestCreate();
127             	TestInfo();
128             	TestCopy();
129 rizwank 1.3 	*/
130 rizwank 1.2 	TestDestroy();
131 rizwank 1.3 	
132 rizwank 1.1 }

Rizwan Kassim
Powered by
ViewCVS 0.9.2