summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2021-03-29 10:01:10 -0400
committerGitHub <noreply@github.com>2021-03-29 10:01:10 -0400
commitc095b7f9c123e1b07bf3844e7aaad9bb1a56d143 (patch)
treeb31a58b033e02a10f47279985f59247839efdd65 /cpp/test
parentFix whitespace (diff)
downloadice-c095b7f9c123e1b07bf3844e7aaad9bb1a56d143.tar.bz2
ice-c095b7f9c123e1b07bf3844e7aaad9bb1a56d143.tar.xz
ice-c095b7f9c123e1b07bf3844e7aaad9bb1a56d143.zip
Support for building C++98 with a C++11 compiler (#1267)
Fixes #1266
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/Glacier2/dynamicFiltering/TestControllerI.h7
-rw-r--r--cpp/test/IceGrid/deployer/AllTests.cpp47
2 files changed, 33 insertions, 21 deletions
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
index 7b4e62be61e..689680b1bbb 100644
--- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
+++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.h
@@ -25,6 +25,13 @@ struct SessionTuple
configured(false)
{}
+ SessionTuple(const SessionTuple& st):
+ session(st.session),
+ sessionControl(st.sessionControl),
+ configured(st.configured)
+ {
+ }
+
SessionTuple&
operator=(const SessionTuple& rhs)
{
diff --git a/cpp/test/IceGrid/deployer/AllTests.cpp b/cpp/test/IceGrid/deployer/AllTests.cpp
index b4ba1780519..8d703f8593a 100644
--- a/cpp/test/IceGrid/deployer/AllTests.cpp
+++ b/cpp/test/IceGrid/deployer/AllTests.cpp
@@ -50,27 +50,32 @@ bool isLongLineEnd(const string& line)
}
-struct ProxyIdentityEqual : public std::binary_function<Ice::ObjectPrx,string,bool>
+#ifdef ICE_CPP11_COMPILER
+function<bool(Ice::ObjectPrxPtr&)>
+proxyIdentityEqual(const string& strId)
{
-
-public:
-
- ProxyIdentityEqual(const Ice::CommunicatorPtr& communicator) :
- _communicator(communicator)
+ return [id = Ice::stringToIdentity(strId)](const Ice::ObjectPrxPtr& obj)
{
- }
-
+ return obj->ice_getIdentity() == id;
+ };
+}
+#else
+struct ProxyEqualIdentity : public std::binary_function<Ice::ObjectPrx,string,bool>
+{
bool
operator()(const Ice::ObjectPrx& p1, const string& id) const
{
return p1->ice_getIdentity() == Ice::stringToIdentity(id);
}
-
-private:
-
- Ice::CommunicatorPtr _communicator;
};
+binder2nd<ProxyEqualIdentity>
+proxyIdentityEqual(const string& strId)
+{
+ return bind2nd(ProxyEqualIdentity(), strId);
+}
+#endif
+
void
logTests(const Ice::CommunicatorPtr& comm, const AdminSessionPrx& session)
{
@@ -416,15 +421,15 @@ allTests(Test::TestHelper* helper)
cout << "testing object registration... " << flush;
Ice::ObjectProxySeq objs = query->findAllObjectsByType("::Test");
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"Server1")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"Server2")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"SimpleServer")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"IceBox1-Service1")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"IceBox1-Service2")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"IceBox2-Service1")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"IceBox2-Service2")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"SimpleIceBox-SimpleService")) != objs.end());
- test(find_if(objs.begin(), objs.end(), bind2nd(ProxyIdentityEqual(comm),"ReplicatedObject")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("Server1")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("Server2")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("SimpleServer")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("IceBox1-Service1")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("IceBox1-Service2")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("IceBox2-Service1")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("IceBox2-Service2")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("SimpleIceBox-SimpleService")) != objs.end());
+ test(find_if(objs.begin(), objs.end(), proxyIdentityEqual("ReplicatedObject")) != objs.end());
{
test(comm->identityToString(query->findObjectByType("::TestId1")->ice_getIdentity()) == "cat/name1");