[Corected] Test for atof (Bug 4337)

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Sat Jan 21 11:15:44 CST 2006


Changelog:
	dlls/msvcrt/test/strings:
	Add a test for atof() exposing a todo_wine

For some reason atof() needs to by used by GetProcAddress() or otherwise the
test will link directly to libc atof()
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/dlls/msvcrt/tests/string.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/tests/string.c,v
retrieving revision 1.6
diff -u -r1.6 string.c
--- wine/dlls/msvcrt/tests/string.c	21 Nov 2005 12:03:18 -0000	1.6
+++ wine/dlls/msvcrt/tests/string.c	21 Jan 2006 17:15:04 -0000
@@ -27,6 +27,7 @@
 
 static void* (*pmemcpy)(void *, const void *, size_t n);
 static int* (*pmemcmp)(void *, const void *, size_t n);
+static double (*patof)(const char *);
 
 #define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
 #define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not found\n", y)
@@ -99,6 +100,32 @@
     ok( ret==0, "_mbsspn returns %d should be 0\n", ret);
 }
 
+static void test_atof( void)
+{
+    char s1[]="  -2309.12E-15";
+    char s2[]="7.8912654773d10";
+    char s3[]="7.8912654773d210";
+    char s4[]="  -9885 pigs";
+    char s5[]="98854 dollars";
+    double x;
+
+    x = patof( s1 );
+    ok(x==-2.309120e-012, "atof(%s) returned  %e\n", s1, x );
+
+    x = patof( s2 );
+    todo_wine ok(x==7.8912654773e10, "atof(%s) returned  %e\n", s2, x );
+    
+    x = patof( s3 );
+    todo_wine ok(x==7.8912654773e210, "atof(%s) returned  %e\n", s3, x );
+    
+    x = patof( s4 );
+    ok(x==-9.885000e+003, "atof(%s) returned  %e\n", s4, x );
+    
+    x = patof( s5 );
+    ok(x==9.885400e+004, "atof(%s) returned  %e\n", s5, x );
+    
+}
+    
 START_TEST(string)
 {
     void *mem;
@@ -108,6 +135,7 @@
     ok(hMsvcrt != 0, "LoadLibraryA failed\n");
     SET(pmemcpy,"memcpy");
     SET(pmemcmp,"memcmp");
+    SET(patof,"atof");
 
     /* MSVCRT memcpy behaves like memmove for overlapping moves,
        MFC42 CString::Insert seems to rely on that behaviour */
@@ -125,4 +153,5 @@
     test_ismbblead();
    /* test _mbsspn */
     test_mbsspn();
+    if (patof) test_atof();
 }



More information about the wine-patches mailing list