[PATCH 3/3] [Dnsapi.dll] Tests
Steven Edwards
winehacker at gmail.com
Thu Mar 2 02:36:26 CST 2006
Hi,
Just a matter of style to save moving the code around later if we add
more tests.
+START_TEST(names)
+{
+ HMODULE hdnsapi = LoadLibrary("dnsapi.dll");
+ char *testname1 = ".bob";
+ char *testname2 = ".bOb";
+
+ trace("Dnsapi.dll is only on Win2k and above.\nChecking...\n");
+ if(hdnsapi != NULL)
+ {
+ trace("Dnsapi.dll loaded.\nNow unloading...\n");
+ FreeLibrary(hdnsapi);
+ }
+ else
+ {
+ trace("Dnsapi.dll was not loaded or failed to be unloaded.\n");
+ return;
+ }
Why don't you break this out in to a function like load_dnsapi() that
way if there are missing symbols from one version to another you can
use GetProcAddress and delay load them and it will all be contained in
one function.
+ trace("Now testing function: DnsNameCompare_A(LPSTR, LPSTR)\n");
+ ok(DnsNameCompare_A(testname1,testname2)==TRUE,
+ "Comparison failed!\n %s and %s should be equal!\n",testname1,testname2);
+ trace("%s and %s are equal.\n",testname1,testname2);
Also it would be a good idea to break this out in to another function.
I tend to do one function per API I am checking so I would stick all
of this in to a function called
test_DnsNameCompare();
+}
Nice work btw. Thanks for being patent with submitting patches and
tests. I am not really that great of a programmer and these type of
style changes help me follow along and write better tests. Take a look
at this test I wrote to get the idea
http://cvs.winehq.org/cvsweb/wine/dlls/setupapi/tests/stringtable.c?rev=1.2&content-type=text/x-cvsweb-markup
It tends to be more lines but I think its much clearer to read.
--
Steven Edwards
"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo
More information about the wine-patches
mailing list