summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Ice/Makefile1
-rw-r--r--cpp/test/Ice/Makefile.mak3
-rw-r--r--cpp/test/Ice/hash/.depend3
-rw-r--r--cpp/test/Ice/hash/.depend.mak3
-rw-r--r--cpp/test/Ice/hash/.gitignore6
-rw-r--r--cpp/test/Ice/hash/Client.cpp139
-rw-r--r--cpp/test/Ice/hash/Makefile33
-rw-r--r--cpp/test/Ice/hash/Makefile.mak49
-rw-r--r--cpp/test/Ice/hash/Test.ice20
-rwxr-xr-xcpp/test/Ice/hash/run.py25
-rw-r--r--cpp/test/WinRT/TestSuite/MainPage.xaml.cpp3
-rw-r--r--cpp/test/WinRT/TestSuite/TestSuite.vcxproj3
-rw-r--r--cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters3
13 files changed, 289 insertions, 2 deletions
diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile
index c9f3b3390ec..15092758312 100644
--- a/cpp/test/Ice/Makefile
+++ b/cpp/test/Ice/Makefile
@@ -24,6 +24,7 @@ SUBDIRS = proxy \
adapterDeactivation \
slicing \
gc \
+ hash \
checksum \
stream \
dispatcher \
diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak
index 12a0b8186de..eaa8112b30a 100644
--- a/cpp/test/Ice/Makefile.mak
+++ b/cpp/test/Ice/Makefile.mak
@@ -20,6 +20,7 @@ SUBDIRS = proxy \
objects \
location \
adapterDeactivation \
+ hash \
ami \
invoke \
dispatcher \
@@ -28,7 +29,7 @@ SUBDIRS = proxy \
retry \
timeout \
udp \
- stream \
+ stream
!if "$(WINRT)" != "yes"
SUBDIRS = $(SUBDIRS) \
diff --git a/cpp/test/Ice/hash/.depend b/cpp/test/Ice/hash/.depend
new file mode 100644
index 00000000000..d48f87cfd5c
--- /dev/null
+++ b/cpp/test/Ice/hash/.depend
@@ -0,0 +1,3 @@
+Client$(OBJEXT): Client.cpp $(includedir)/Ice/Ice.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/IconvStringConverter.h Test.h ../../include/TestCommon.h $(includedir)/IceUtil/IceUtil.h $(includedir)/IceUtil/AbstractMutex.h $(includedir)/IceUtil/Cache.h $(includedir)/IceUtil/CountDownLatch.h $(includedir)/IceUtil/CtrlCHandler.h $(includedir)/IceUtil/MutexPtrLock.h $(includedir)/IceUtil/RecMutex.h $(includedir)/IceUtil/UUID.h
+Test$(OBJEXT): Test.cpp Test.h $(includedir)/Ice/LocalObjectF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Handle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyF.h $(includedir)/Ice/ProxyHandle.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Exception.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/Iterator.h
+Test.h Test.cpp: Test.ice $(SLICE2CPP) $(SLICEPARSERLIB)
diff --git a/cpp/test/Ice/hash/.depend.mak b/cpp/test/Ice/hash/.depend.mak
new file mode 100644
index 00000000000..ebd394b6929
--- /dev/null
+++ b/cpp/test/Ice/hash/.depend.mak
@@ -0,0 +1,3 @@
+Client$(OBJEXT): Client.cpp "$(includedir)/Ice/Ice.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Initialize.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/Ice/Handle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyF.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/PropertiesF.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/LoggerF.h" "$(includedir)/Ice/StatsF.h" "$(includedir)/Ice/Dispatcher.h" "$(includedir)/Ice/StringConverter.h" "$(includedir)/Ice/Plugin.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/Ice/Stream.h" "$(includedir)/IceUtil/Unicode.h" "$(includedir)/Ice/LocalException.h" "$(includedir)/Ice/Properties.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/Logger.h" "$(includedir)/Ice/LoggerUtil.h" "$(includedir)/Ice/Stats.h" "$(includedir)/Ice/Communicator.h" "$(includedir)/Ice/RouterF.h" "$(includedir)/Ice/LocatorF.h" "$(includedir)/Ice/PluginF.h" "$(includedir)/Ice/ImplicitContextF.h" "$(includedir)/Ice/CommunicatorAsync.h" "$(includedir)/Ice/ObjectFactory.h" "$(includedir)/Ice/ObjectAdapter.h" "$(includedir)/Ice/FacetMap.h" "$(includedir)/Ice/Endpoint.h" "$(includedir)/Ice/ServantLocator.h" "$(includedir)/Ice/IncomingAsync.h" "$(includedir)/Ice/Process.h" "$(includedir)/Ice/Application.h" "$(includedir)/Ice/Connection.h" "$(includedir)/Ice/ConnectionAsync.h" "$(includedir)/Ice/Functional.h" "$(includedir)/IceUtil/Functional.h" "$(includedir)/Ice/ImplicitContext.h" "$(includedir)/Ice/Locator.h" "$(includedir)/Ice/FactoryTableInit.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/ProcessF.h" "$(includedir)/Ice/Router.h" "$(includedir)/Ice/DispatchInterceptor.h" "$(includedir)/Ice/IconvStringConverter.h" Test.h ../../include/TestCommon.h "$(includedir)/IceUtil/IceUtil.h" "$(includedir)/IceUtil/AbstractMutex.h" "$(includedir)/IceUtil/Cache.h" "$(includedir)/IceUtil/CountDownLatch.h" "$(includedir)/IceUtil/CtrlCHandler.h" "$(includedir)/IceUtil/MutexPtrLock.h" "$(includedir)/IceUtil/RecMutex.h" "$(includedir)/IceUtil/UUID.h"
+Test$(OBJEXT): Test.cpp Test.h "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Handle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyF.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/FactoryTableInit.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/LocalException.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/Ice/Stream.h" "$(includedir)/Ice/ObjectFactory.h" "$(includedir)/IceUtil/Iterator.h"
+Test.h Test.cpp: Test.ice "$(SLICE2CPP)" "$(SLICEPARSERLIB)"
diff --git a/cpp/test/Ice/hash/.gitignore b/cpp/test/Ice/hash/.gitignore
new file mode 100644
index 00000000000..d780341c0e4
--- /dev/null
+++ b/cpp/test/Ice/hash/.gitignore
@@ -0,0 +1,6 @@
+// Generated by makegitignore.py
+
+// IMPORTANT: Do not edit this file -- any edits made here will be lost!
+client
+Test.h
+Test.cpp
diff --git a/cpp/test/Ice/hash/Client.cpp b/cpp/test/Ice/hash/Client.cpp
new file mode 100644
index 00000000000..833ce35dc9d
--- /dev/null
+++ b/cpp/test/Ice/hash/Client.cpp
@@ -0,0 +1,139 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/Ice.h>
+#include <IceUtil/Random.h>
+#include <Test.h>
+#include <TestCommon.h>
+
+using namespace std;
+using namespace Test;
+
+DEFINE_TEST("client")
+
+int main(int argc, char** argv)
+{
+ cout << "testing proxy & endpoint hash algorithm collisions... " << flush;
+ map<Ice::Int, Ice::ObjectPrx> seenProxy;
+ map<Ice::Int, Ice::EndpointPtr> seenEndpoint;
+ unsigned int proxyCollisions = 0;
+ unsigned int endpointCollisions = 0;
+ unsigned int i = 0;
+ unsigned int maxCollisions = 10;
+ unsigned int maxIterations = 10000;
+
+ Ice::InitializationData id;
+ id.properties = Ice::createProperties(argc, argv);
+#ifndef ICE_OS_WINRT
+ //
+ // In Ice for WinRT IceSSL is part of Ice core.
+ //
+ id.properties->setProperty("Ice.Plugin.IceSSL", "IceSSL:createIceSSL");
+#endif
+ Ice::CommunicatorPtr communicator = Ice::initialize(id);
+ for(i = 0; proxyCollisions < maxCollisions &&
+ endpointCollisions < maxCollisions &&
+ i < maxIterations; ++i)
+ {
+ ostringstream os;
+ os << i << ":tcp -p " << IceUtilInternal::random(65536) << " -t 10" << IceUtilInternal::random(1000000)
+ << ":udp -p " << IceUtilInternal::random(65536) << " -h " << IceUtilInternal::random(100);
+
+ Ice::ObjectPrx obj = communicator->stringToProxy(os.str());
+ Ice::EndpointSeq endpoints = obj->ice_getEndpoints();
+ if(!seenProxy.insert(make_pair(obj->ice_getHash(), obj)).second)
+ {
+ ++proxyCollisions;
+ }
+ test(obj->ice_getHash() == obj->ice_getHash());
+
+ for(Ice::EndpointSeq::const_iterator j = endpoints.begin(); j != endpoints.end(); ++j)
+ {
+ Ice::EndpointPtr endpoint = (*j);
+ if(!seenEndpoint.insert(make_pair(endpoint->ice_getHash(), endpoint)).second)
+ {
+ if(endpoint == seenEndpoint[endpoint->ice_getHash()])
+ {
+ continue; // Same object
+ }
+ ++endpointCollisions;
+ }
+ test(endpoint->ice_getHash() == endpoint->ice_getHash());
+ }
+ }
+ test(proxyCollisions < maxCollisions);
+ test(endpointCollisions < maxCollisions);
+
+ //
+ // Check the same proxy produce the same hash, even when we recreate the proxy.
+ //
+ Ice::ObjectPrx prx1 = communicator->stringToProxy("Glacier2/router:tcp -p 10010");
+ Ice::ObjectPrx prx2 = communicator->stringToProxy("Glacier2/router:ssl -p 10011");
+ Ice::ObjectPrx prx3 = communicator->stringToProxy("Glacier2/router:udp -p 10012");
+ Ice::ObjectPrx prx4 = communicator->stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010");
+ Ice::ObjectPrx prx5 = communicator->stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011");
+ Ice::ObjectPrx prx6 = communicator->stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012");
+ Ice::ObjectPrx prx7 = communicator->stringToProxy("Glacier2/router:tcp -p 10010 -t 10000");
+ Ice::ObjectPrx prx8 = communicator->stringToProxy("Glacier2/router:ssl -p 10011 -t 10000");
+ Ice::ObjectPrx prx9 = communicator->stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000");
+ Ice::ObjectPrx prx10 = communicator->stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000");
+
+ map<string, int> proxyMap;
+ proxyMap["prx1"] = prx1->ice_getHash();
+ proxyMap["prx2"] = prx2->ice_getHash();
+ proxyMap["prx3"] = prx3->ice_getHash();
+ proxyMap["prx4"] = prx4->ice_getHash();
+ proxyMap["prx5"] = prx5->ice_getHash();
+ proxyMap["prx6"] = prx6->ice_getHash();
+ proxyMap["prx7"] = prx7->ice_getHash();
+ proxyMap["prx8"] = prx8->ice_getHash();
+ proxyMap["prx9"] = prx9->ice_getHash();
+ proxyMap["prx10"] = prx10->ice_getHash();
+
+ test( communicator->stringToProxy("Glacier2/router:tcp -p 10010")->ice_getHash() == proxyMap["prx1"]);
+ test( communicator->stringToProxy("Glacier2/router:ssl -p 10011")->ice_getHash() == proxyMap["prx2"]);
+ test( communicator->stringToProxy("Glacier2/router:udp -p 10012")->ice_getHash() == proxyMap["prx3"]);
+ test( communicator->stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010")->ice_getHash() == proxyMap["prx4"]);
+ test( communicator->stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011")->ice_getHash() == proxyMap["prx5"]);
+ test( communicator->stringToProxy("Glacier2/router:udp -h zeroc.com -p 10012")->ice_getHash() == proxyMap["prx6"]);
+ test( communicator->stringToProxy("Glacier2/router:tcp -p 10010 -t 10000")->ice_getHash() == proxyMap["prx7"]);
+ test( communicator->stringToProxy("Glacier2/router:ssl -p 10011 -t 10000")->ice_getHash() == proxyMap["prx8"]);
+ test( communicator->stringToProxy("Glacier2/router:tcp -h zeroc.com -p 10010 -t 10000")->ice_getHash() == proxyMap["prx9"]);
+ test( communicator->stringToProxy("Glacier2/router:ssl -h zeroc.com -p 10011 -t 10000")->ice_getHash() == proxyMap["prx10"]);
+
+ cerr << "ok" << endl;
+
+ cout << "testing objects hash algorithm collisions... " << flush;
+ unsigned int objectCollisions = 0;
+ map<Ice::Int, Ice::ObjectPtr> seenObject;
+ for(i = 0; objectCollisions < maxCollisions && i < maxIterations; ++i)
+ {
+ Ice::ObjectPtr obj = new Point;
+ if(!seenObject.insert(make_pair(obj->ice_getHash(), obj)).second)
+ {
+ ++objectCollisions;
+ }
+ test(obj->ice_getHash() == obj->ice_getHash());
+ }
+ test(objectCollisions < maxCollisions);
+
+ cerr << "ok" << endl;
+ if(communicator)
+ {
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ cerr << ex << endl;
+ }
+ }
+ return EXIT_SUCCESS;
+}
diff --git a/cpp/test/Ice/hash/Makefile b/cpp/test/Ice/hash/Makefile
new file mode 100644
index 00000000000..250beb61bf6
--- /dev/null
+++ b/cpp/test/Ice/hash/Makefile
@@ -0,0 +1,33 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ../../..
+
+CLIENT = client
+
+TARGETS = $(CLIENT)
+
+COBJS = Client.o
+
+OBJS = Test.o
+
+SRCS = $(COBJS:.o=.cpp) \
+ $(OBJS:.o=.cpp)
+
+SLICE_SRCS = Test.ice
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I. -I../../include $(CPPFLAGS)
+
+$(CLIENT): $(OBJS) $(COBJS)
+ rm -f $@
+ $(CXX) $(LDFLAGS) -o $@ $(COBJS) $(OBJS) $(LIBS)
+
+include .depend
diff --git a/cpp/test/Ice/hash/Makefile.mak b/cpp/test/Ice/hash/Makefile.mak
new file mode 100644
index 00000000000..b231eda718d
--- /dev/null
+++ b/cpp/test/Ice/hash/Makefile.mak
@@ -0,0 +1,49 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+top_srcdir = ..\..\..
+
+!if "$(WINRT)" != "yes"
+NAME_PREFIX =
+EXT = .exe
+!else
+NAME_PREFIX = Ice_hash_
+EXT = .dll
+!endif
+
+CLIENT = $(NAME_PREFIX)client
+
+TARGETS = $(CLIENT)$(EXT)
+
+COBJS = Test.obj \
+ Client.obj
+
+SRCS = $(COBJS:.obj=.cpp)
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN
+
+
+!if "$(WINRT)" != "yes"
+LD_TESTFLAGS = $(LD_EXEFLAGS) $(SETARGV)
+!else
+LD_TESTFLAGS = $(LD_DLLFLAGS) /export:dllMain
+!endif
+
+!if "$(GENERATE_PDB)" == "yes"
+CPDBFLAGS = /pdb:$(CLIENT).pdb
+!endif
+
+$(CLIENT)$(EXT): $(COBJS)
+ $(LINK) $(LD_TESTFLAGS) $(CPDBFLAGS) $(SETARGV) $(COBJS) $(PREOUT)$@ $(PRELIBS)$(LIBS)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest
+
+!include .depend.mak
diff --git a/cpp/test/Ice/hash/Test.ice b/cpp/test/Ice/hash/Test.ice
new file mode 100644
index 00000000000..0bc77e005b6
--- /dev/null
+++ b/cpp/test/Ice/hash/Test.ice
@@ -0,0 +1,20 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#pragma once
+
+module Test
+{
+
+class Point
+{
+};
+
+};
+
diff --git a/cpp/test/Ice/hash/run.py b/cpp/test/Ice/hash/run.py
new file mode 100755
index 00000000000..3c4472ca289
--- /dev/null
+++ b/cpp/test/Ice/hash/run.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+# **********************************************************************
+#
+# Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+import os, sys
+
+path = [ ".", "..", "../..", "../../..", "../../../.." ]
+head = os.path.dirname(sys.argv[0])
+if len(head) > 0:
+ path = [os.path.join(head, p) for p in path]
+path = [os.path.abspath(p) for p in path if os.path.exists(os.path.join(p, "scripts", "TestUtil.py")) ]
+if len(path) == 0:
+ raise "can't find toplevel directory!"
+sys.path.append(os.path.join(path[0]))
+from scripts import *
+
+client = os.path.join(os.getcwd(), "client")
+TestUtil.simpleTest(client)
+
diff --git a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp
index a572f49a96f..1b36c721576 100644
--- a/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp
+++ b/cpp/test/WinRT/TestSuite/MainPage.xaml.cpp
@@ -300,7 +300,8 @@ static const TestCase allTest[] =
{"Ice\\retry", "Ice_retry_", "client.dll", "server.dll", 0, 0 },
{"Ice\\stream", "Ice_stream_", "client.dll", 0, 0, 0},
{"Ice\\timeout", "Ice_timeout_", "client.dll", "server.dll", 0, 0 },
- {"Ice\\udp", "Ice_udp_", "client.dll", "server.dll", 0, 0 }
+ {"Ice\\udp", "Ice_udp_", "client.dll", "server.dll", 0, 0 },
+ {"Ice\\hash", "Ice_hash_", "client.dll", 0, 0, 0}
};
class TestRunner : public IceUtil::Thread
diff --git a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj
index 3e6321b9bc0..ee8bd766392 100644
--- a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj
+++ b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj
@@ -227,6 +227,9 @@
<None Include="..\..\Ice\facets\Ice_facets_server.dll">
<DeploymentContent>true</DeploymentContent>
</None>
+ <None Include="..\..\Ice\hash\Ice_hash_client.dll">
+ <DeploymentContent>true</DeploymentContent>
+ </None>
<None Include="..\..\Ice\hold\Ice_hold_client.dll">
<DeploymentContent>true</DeploymentContent>
</None>
diff --git a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters
index a265ba6d68e..05791395699 100644
--- a/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters
+++ b/cpp/test/WinRT/TestSuite/TestSuite.vcxproj.filters
@@ -196,6 +196,9 @@
<Filter>Tests</Filter>
</None>
<None Include="key.pfx" />
+ <None Include="..\..\Ice\hash\Ice_hash_client.dll">
+ <Filter>Tests</Filter>
+ </None>
</ItemGroup>
<ItemGroup>
<Page Include="MainPage.xaml" />