You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/02/14 01:37:23 UTC

svn commit: r377550 - /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp

Author: nadiramra
Date: Mon Feb 13 16:37:23 2006
New Revision: 377550

URL: http://svn.apache.org/viewcvs?rev=377550&view=rev
Log:
Cannot compare time structures without taking into account
timezone, so convert time structures to asctime() and 
compare results. 

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp?rev=377550&r1=377549&r2=377550&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp Mon Feb 13 16:37:23 2006
@@ -332,37 +332,38 @@
 			ws.setTransportProperty( "SOAPAction", "InteropBase#echoDate");
 
 			xsd__dateTime	ed_temp = ws.echoDate( time);
+			
+			// A simple memcmp of ed_temp and time will not work because
+			// it does not take into account timezone, so we need to 
+			// compare results of asctime()
+			char ExpectedTime[1024];
+			char ReturnedTime[1024];
+			
+			char *	pExpectedTime = asctime( &time );
+			int	 iETLength = (pExpectedTime != NULL) ? (int) strlen(pExpectedTime) : 0;
+			if (iETLength > 0)
+				strcpy(ExpectedTime, pExpectedTime);
+			
+			char *	pReturnedTime = asctime( &ed_temp );
+			int		iRTLength = (pReturnedTime != NULL) ? (int) strlen(pReturnedTime) : 0;
+			if( iRTLength > 0)
+				strcpy(ReturnedTime, pReturnedTime);
 
-			if( memcmp( &ed_temp, &time, sizeof( struct tm)) == 0)
+			if( iETLength > 0 && 
+				iRTLength > 0 &&
+				strcmp(ExpectedTime, ReturnedTime) == 0)
 			{
 				cout << "successful" << endl;
 			}
 			else
 			{
-				char *	pExpectedTime = asctime( &ed_temp);
-				int		iETLength = (int) strlen( pExpectedTime);
-				char *	pReturnedTime = asctime( temp);
-				int		iRTLength = (int) strlen( pReturnedTime);
+				if( iETLength == 0)
+					strcpy(ExpectedTime,"NULL");
 
-				if( iETLength > 0)
-				{
-					pExpectedTime[iETLength - 1] = '\0';
-				}
-				else
-				{
-					pExpectedTime = "NULL";
-				}
-
-				if( iRTLength > 0)
-				{
-					pReturnedTime[iRTLength - 1] = '\0';
-				}
-				else
-				{
-					pReturnedTime = "NULL";
-				}
-
-				cout << "Failed.  The expected time (" << pExpectedTime << ") was not the same as the returned time (" << pReturnedTime << ")." << endl;
+				if( iRTLength == 0)
+					strcpy(ReturnedTime,"NULL");
+	
+				cout << "Failed.  The expected time (" << ExpectedTime << ") was not the same as the returned time (" << ReturnedTime << ")." << endl;
 			}
 
 	//testing echo hex binary