axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r1125244 - in /axis/axis1/c/trunk/tests/auto_build/testcases/client/c: CommonClientTestCode.h XSD_dateClient.c XSD_gYearClient.c XSD_gYearMonthClient.c
Date Fri, 20 May 2011 05:40:48 GMT
Author: nadiramra
Date: Fri May 20 05:40:48 2011
New Revision: 1125244

URL: http://svn.apache.org/viewvc?rev=1125244&view=rev
Log:
Minor - Test cases should take into account daylight saving time

Modified:
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateClient.c
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearClient.c
    axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearMonthClient.c

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h?rev=1125244&r1=1125243&r2=1125244&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/CommonClientTestCode.h Fri May
20 05:40:48 2011
@@ -152,6 +152,23 @@ char * asciiToStringOfLength( char * pSt
 // daylight saving time...so that when we spit out the results it will
 // match what is expected (which is not with daylight saving time)
 
+void dumpTimeStruct(struct tm *t, char *hdr)
+{
+    if (0)
+    {
+      printf(hdr);
+      printf("tm_hour:  %d\n",t->tm_hour);
+      printf("tm_min:  %d\n",t->tm_min);
+      printf("tm_sec:  %d\n",t->tm_sec);
+      printf("tm_mon:  %d\n",t->tm_mon);
+      printf("tm_mday:  %d\n",t->tm_mday);
+      printf("tm_year:  %d\n",t->tm_year);
+      printf("tm_yday:  %d\n",t->tm_yday);
+      printf("tm_wday:  %d\n",t->tm_wday);
+      printf("tm_isdst:  %d\n",t->tm_isdst);
+    }
+}
+
 C_BOOL isDSTInEffect()
 {
     time_t currentTime;
@@ -168,42 +185,21 @@ C_BOOL isDSTInEffect()
 
 struct tm * adjustTimeStruct(struct tm *t)
 {
+    time_t timeInSecs;
+    struct tm *temp;
 
-    if (0)
-    {
-      printf("tm_hour:  %d\n",t->tm_hour);
-      printf("tm_min:  %d\n",t->tm_min);
-      printf("tm_sec:  %d\n",t->tm_sec);
-      printf("tm_mon:  %d\n",t->tm_mon);
-      printf("tm_mday:  %d\n",t->tm_mday);
-      printf("tm_year:  %d\n",t->tm_year);
-      printf("tm_yday:  %d\n",t->tm_yday);
-      printf("tm_wday:  %d\n",t->tm_wday);
-      printf("tm_isdst:  %d\n",t->tm_isdst);
-    }
+    dumpTimeStruct(t, "before\n");
 
     if (isDSTInEffect())
-    {
-        --(t->tm_hour);
+        t->tm_isdst = 1;
 
-       if (t->tm_hour < 0)
-            mktime (t);
-    }
+    timeInSecs= mktime (t);
 
-    if (0)
-    {
-     printf("===After\n");
+    temp = gmtime(&timeInSecs);
 
-     printf("tm_hour:  %d\n",t->tm_hour);
-     printf("tm_min:  %d\n",t->tm_min);
-     printf("tm_sec:  %d\n",t->tm_sec);
-     printf("tm_mon:  %d\n",t->tm_mon);
-     printf("tm_mday:  %d\n",t->tm_mday);
-     printf("tm_year:  %d\n",t->tm_year);
-     printf("tm_yday:  %d\n",t->tm_yday);
-     printf("tm_wday:  %d\n",t->tm_wday);
-     printf("tm_isdst:  %d\n",t->tm_isdst);
-    }
+    *t = *temp;
+
+    dumpTimeStruct(t, "after\n");
 
     return t;
 }

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateClient.c?rev=1125244&r1=1125243&r2=1125244&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_dateClient.c Fri May 20 05:40:48
2011
@@ -51,14 +51,14 @@ int main(int argc, char* argv[])
 
     // Test non-nillable element
     result = asNonNillableElement(ws, input);
-    strftime(returnString, 50, "%a %b %d %Y", &result);
+    strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct(&result));
     printf( "non-nillable element=%s\n" , returnString );
 
     // Test nillable element, with a value
     nillableResult = asNillableElement(ws, &input);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%a %b %d %Y", nillableResult);
+        strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct(nillableResult));
         printf( "nillable element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_DATE);
     }
@@ -69,7 +69,7 @@ int main(int argc, char* argv[])
     nillableResult = asNillableElement(ws, NULL);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%a %b %d %Y", nillableResult);
+        strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct(nillableResult));
         printf( "nil element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_DATE);
     }
@@ -84,7 +84,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.requiredAttribute= (input);
         requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
         result = requiredAttributeResult->requiredAttribute;
-        strftime(returnString, 50, "%a %b %d %Y", &result);
+        strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct(&result));
         printf( "required attribute=%s\n" , returnString );
         Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
     }
@@ -150,7 +150,7 @@ int main(int argc, char* argv[])
 
         for (i = 0; i < outputSize ; i++)
         {
-            strftime(returnString, 50, "%a %b %d %Y", output[i]);
+            strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct((struct tm *)output[i]));
             printf( "  element[%d]=%s\n", i , returnString );
         }
 
@@ -165,7 +165,7 @@ int main(int argc, char* argv[])
         complexTypeInput.complexTypeElement = input;
         complexTypeResult =  asComplexType(ws, &complexTypeInput);
         result = complexTypeResult->complexTypeElement;
-        strftime(returnString, 50, "%a %b %d %Y", &result);
+        strftime(returnString, 50, "%a %b %d %Y", adjustTimeStruct(&result));
         printf( "within complex type=%s\n" , returnString );
         Axis_Delete_SimpleComplexType(complexTypeResult, 0);
     }

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearClient.c?rev=1125244&r1=1125243&r2=1125244&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearClient.c Fri May 20 05:40:48
2011
@@ -50,14 +50,14 @@ int main(int argc, char* argv[])
 
     // Test non-nillable element
     result = asNonNillableElement(ws, input);
-    strftime(returnString, 50, "%Y", &result);
+    strftime(returnString, 50, "%Y", adjustTimeStruct(&result));
     printf( "non-nillable element=%s\n" , returnString );
 
     // Test nillable element, with a value
     nillableResult = asNillableElement(ws, &input);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%Y", nillableResult);
+        strftime(returnString, 50, "%Y", adjustTimeStruct(nillableResult));
         printf( "nillable element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_GYEAR);
     }
@@ -68,7 +68,7 @@ int main(int argc, char* argv[])
     nillableResult = asNillableElement(ws, NULL);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%Y", nillableResult);
+        strftime(returnString, 50, "%Y", adjustTimeStruct(nillableResult));
         printf( "nil element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_GYEAR);
     }
@@ -83,7 +83,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.requiredAttribute = input;
         requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
         result = requiredAttributeResult->requiredAttribute;
-        strftime(returnString, 50, "%Y", &result);
+        strftime(returnString, 50, "%Y", adjustTimeStruct(&result));
         printf( "required attribute=%s\n" , returnString );
         Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
     }
@@ -144,7 +144,7 @@ int main(int argc, char* argv[])
 
         for (i = 0; i < outputSize ; i++)
         {
-            strftime(returnString, 50, "%Y", output[i]);
+            strftime(returnString, 50, "%Y", adjustTimeStruct((struct tm *)output[i]));
             printf( "  element[%d]=%s\n" , i, returnString );
         }
         axiscAxisDelete(arrayResult, XSDC_ARRAY);
@@ -159,7 +159,7 @@ int main(int argc, char* argv[])
         complexTypeInput.complexTypeElement =input;
         complexTypeResult = asComplexType(ws, &complexTypeInput);
         result = complexTypeResult->complexTypeElement;
-        strftime(returnString, 50, "%Y", &result);
+        strftime(returnString, 50, "%Y", adjustTimeStruct(&result));
         printf( "within complex type=%s\n" , returnString );
         Axis_Delete_SimpleComplexType(complexTypeResult, 0);
     }

Modified: axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearMonthClient.c
URL: http://svn.apache.org/viewvc/axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearMonthClient.c?rev=1125244&r1=1125243&r2=1125244&view=diff
==============================================================================
--- axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearMonthClient.c (original)
+++ axis/axis1/c/trunk/tests/auto_build/testcases/client/c/XSD_gYearMonthClient.c Fri May
20 05:40:48 2011
@@ -49,14 +49,14 @@ int main(int argc, char* argv[])
 
     // Test non-nillable element
     result = asNonNillableElement(ws, input);
-    strftime(returnString, 50, "%b %Y", &result);
+    strftime(returnString, 50, "%b %Y", adjustTimeStruct(&result));
     printf( "non-nillable element=%s\n" , returnString );
 
     // Test nillable element, with a value
     nillableResult = asNillableElement(ws, &input);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%b %Y", nillableResult);
+        strftime(returnString, 50, "%b %Y", adjustTimeStruct(nillableResult));
         printf( "nillable element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_GYEARMONTH);
     }
@@ -67,7 +67,7 @@ int main(int argc, char* argv[])
     nillableResult = asNillableElement(ws, NULL);
     if (nillableResult)
     {
-        strftime(returnString, 50, "%b %Y", nillableResult);
+        strftime(returnString, 50, "%b %Y", adjustTimeStruct(nillableResult));
         printf( "nil element=%s\n" , returnString );
         axiscAxisDelete(nillableResult, XSDC_GYEARMONTH);
     }
@@ -82,7 +82,7 @@ int main(int argc, char* argv[])
         requiredAttributeInput.requiredAttribute = input;
         requiredAttributeResult = asRequiredAttribute(ws, &requiredAttributeInput);
         result = requiredAttributeResult->requiredAttribute;
-        strftime(returnString, 50, "%b %Y", &result);
+        strftime(returnString, 50, "%b %Y", adjustTimeStruct(&result));
         printf( "required attribute=%s\n" , returnString );
         Axis_Delete_RequiredAttributeElement(requiredAttributeResult, 0);
     }
@@ -143,7 +143,7 @@ int main(int argc, char* argv[])
 
         for (i = 0; i < outputSize ; i++)
         {
-            strftime(returnString, 50, "%b %Y", output[i]);
+            strftime(returnString, 50, "%b %Y", adjustTimeStruct((struct tm *)output[i]));
             printf( "  element[%d]=%s\n" , i, returnString );
         }
 
@@ -159,7 +159,7 @@ int main(int argc, char* argv[])
         complexTypeInput.complexTypeElement = input;
         complexTypeResult = asComplexType(ws, &complexTypeInput);
         result = complexTypeResult->complexTypeElement;
-        strftime(returnString, 50, "%b %Y", &result);
+        strftime(returnString, 50, "%b %Y", adjustTimeStruct(&result));
         printf( "within complex type=%s\n" , returnString );
         Axis_Delete_SimpleComplexType(complexTypeResult, 0);
     }



Mime
View raw message