diff options
Diffstat (limited to 'cpp/test')
25 files changed, 60 insertions, 56 deletions
diff --git a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp index b95aa4ffa07..e7490d220c3 100644 --- a/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp +++ b/cpp/test/Glacier2/dynamicFiltering/TestControllerI.cpp @@ -65,7 +65,7 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke case Test::Running: { - TestConfiguration& config = _configurations[currentState.config]; + TestConfiguration& config = _configurations[static_cast<size_t>(currentState.config)]; assert(!config.description.empty()); bool found = false; @@ -113,14 +113,14 @@ TestControllerI::step(const Glacier2::SessionPrx& currentSession, const TestToke // // New test configuration! // - config = _configurations[newState.config]; + config = _configurations[static_cast<size_t>(newState.config)]; newState.description = config.description; newState.caseIndex = 0; reconfigure = true; } - newState.expectedResult = config.cases[newState.caseIndex].expectedResult; - newState.testReference = config.cases[newState.caseIndex].proxy; + newState.expectedResult = config.cases[static_cast<size_t>(newState.caseIndex)].expectedResult; + newState.testReference = config.cases[static_cast<size_t>(newState.caseIndex)].proxy; if(reconfigure) { diff --git a/cpp/test/Ice/background/Transceiver.cpp b/cpp/test/Ice/background/Transceiver.cpp index b59af9a782c..8bbd15f8a93 100644 --- a/cpp/test/Ice/background/Transceiver.cpp +++ b/cpp/test/Ice/background/Transceiver.cpp @@ -103,8 +103,8 @@ Transceiver::read(IceInternal::Buffer& buf) } } assert(_readBuffer.i > _readBufferPos); - size_t requested = buf.b.end() - buf.i; - size_t available = _readBuffer.i - _readBufferPos; + size_t requested = static_cast<size_t>(buf.b.end() - buf.i); + size_t available = static_cast<size_t>(_readBuffer.i - _readBufferPos); assert(available > 0); if(available >= requested) { diff --git a/cpp/test/Ice/binding/AllTests.cpp b/cpp/test/Ice/binding/AllTests.cpp index 39b6d1cc760..67c1e42ac0c 100644 --- a/cpp/test/Ice/binding/AllTests.cpp +++ b/cpp/test/Ice/binding/AllTests.cpp @@ -239,7 +239,7 @@ allTests(Test::TestHelper* helper) #else if(count < 20 && count % 4 == 0) { - com->deactivateObjectAdapter(adapters[count / 4 - 1]); + com->deactivateObjectAdapter(adapters[static_cast<size_t>(count / 4 - 1)]); --adapterCount; } #endif diff --git a/cpp/test/Ice/custom/AllTests.cpp b/cpp/test/Ice/custom/AllTests.cpp index d5255a187a9..97831b435cb 100644 --- a/cpp/test/Ice/custom/AllTests.cpp +++ b/cpp/test/Ice/custom/AllTests.cpp @@ -621,7 +621,7 @@ allTests(Test::TestHelper* helper) in[3] = 4 / 3; in[4] = -5.725; Ice::Double inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } @@ -641,7 +641,7 @@ allTests(Test::TestHelper* helper) in[3] = false; in[4] = true; bool inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } @@ -1261,7 +1261,7 @@ allTests(Test::TestHelper* helper) in[3] = 4 / 3; in[4] = -5.725; Ice::Double inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } @@ -1288,7 +1288,7 @@ allTests(Test::TestHelper* helper) in[3] = false; in[4] = true; bool inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } @@ -2041,7 +2041,7 @@ allTests(Test::TestHelper* helper) in[3] = 4 / 3; in[4] = -5.725; Ice::Double inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } @@ -2082,7 +2082,7 @@ allTests(Test::TestHelper* helper) in[3] = false; in[4] = true; bool inArray[5]; - for(int i = 0; i < 5; ++i) + for(size_t i = 0; i < 5; ++i) { inArray[i] = in[i]; } diff --git a/cpp/test/Ice/custom/CustomBuffer.h b/cpp/test/Ice/custom/CustomBuffer.h index c5e81565075..553a65cf7df 100644 --- a/cpp/test/Ice/custom/CustomBuffer.h +++ b/cpp/test/Ice/custom/CustomBuffer.h @@ -183,7 +183,7 @@ struct StreamHelper< ::Test::CustomBuffer<T>, StreamHelperCategorySequence> std::pair<const T*, const T*> a; stream->read(a, p); T* b = p.release(); - size_t count = a.second - a.first; + size_t count = static_cast<size_t>(a.second - a.first); if(b == 0 && count > 0) { b = new T[count]; diff --git a/cpp/test/Ice/custom/StringConverterI.cpp b/cpp/test/Ice/custom/StringConverterI.cpp index ded10b7b228..a436bb6508b 100644 --- a/cpp/test/Ice/custom/StringConverterI.cpp +++ b/cpp/test/Ice/custom/StringConverterI.cpp @@ -30,7 +30,7 @@ Test::StringConverterI::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd, target.resize(size); for(size_t i = 0; i < size; ++i) { - target[i] = static_cast<Byte>(toupper(sourceStart[i])); + target[i] = static_cast<char>(toupper(sourceStart[i])); } } diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp index 4bf38d8aa86..9bf572df30c 100644 --- a/cpp/test/Ice/gc/Client.cpp +++ b/cpp/test/Ice/gc/Client.cpp @@ -370,14 +370,16 @@ allTests() { nodes.push_back(new N()); } + for(int j = 0; j < i; ++j) { - nodes[j]->left = nodes[IceUtilInternal::random(i)]; - nodes[j]->right = nodes[IceUtilInternal::random(i)]; + nodes[static_cast<size_t>(j)]->left = nodes[IceUtilInternal::random(i)]; + nodes[static_cast<size_t>(j)]->right = nodes[IceUtilInternal::random(i)]; } + for(int j = 0; j < i; ++j) { - nodes[j]->ice_collectable(true); + nodes[static_cast<size_t>(j)]->ice_collectable(true); } test(getNum() == i); } diff --git a/cpp/test/Ice/hold/AllTests.cpp b/cpp/test/Ice/hold/AllTests.cpp index ed2242f863c..047fdd01d49 100644 --- a/cpp/test/Ice/hold/AllTests.cpp +++ b/cpp/test/Ice/hold/AllTests.cpp @@ -173,7 +173,7 @@ allTests(Test::TestHelper* helper) while(cond->value()) { result = hold->begin_set(value + 1, - IceUtilInternal::random(5), + static_cast<Ice::Int>(IceUtilInternal::random(5)), newCallback_Hold_set(new SetCB(cond, value), &SetCB::response, &SetCB::exception)); ++value; if(value % 100 == 0) @@ -236,7 +236,7 @@ allTests(Test::TestHelper* helper) while(value < 3000 && cond->value()) { result = holdSerialized->begin_set(value + 1, - IceUtilInternal::random(1), + static_cast<Ice::Int>(IceUtilInternal::random(1)), newCallback_Hold_set(new SetCB(cond, value), &SetCB::response, &SetCB::exception)); diff --git a/cpp/test/Ice/invoke/test.py b/cpp/test/Ice/invoke/test.py new file mode 100644 index 00000000000..176ed12558f --- /dev/null +++ b/cpp/test/Ice/invoke/test.py @@ -0,0 +1,8 @@ +# +# Copyright (c) ZeroC, Inc. All rights reserved. +# + +TestSuite(__file__, + [ClientServerTestCase(), + ClientServerTestCase(name = "client/server array", servers=[Server(args = ["--array"])]), + ClientServerTestCase(name = "client/server async", servers=[Server(args = ["--async"])])]) diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index dbd6bccde34..e152939fbdd 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -437,8 +437,6 @@ interface MyDerivedClass extends Test::MyClass } - - // // Test proxy inheritance for class with operations // see: https://github.com/zeroc-ice/ice/issues/406 diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 41779343cd3..4c3bc092299 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -1699,7 +1699,7 @@ twoways(const Ice::CommunicatorPtr& communicator, Test::TestHelper* helper, cons test(r.size() == static_cast<size_t>(lengths[l])); for(int j = 0; j < static_cast<int>(r.size()); ++j) { - test(r[j] == -j); + test(r[static_cast<size_t>(j)] == -j); } } } diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp index f37ce43077a..e71852c300a 100644 --- a/cpp/test/Ice/operations/TwowaysAMI.cpp +++ b/cpp/test/Ice/operations/TwowaysAMI.cpp @@ -983,7 +983,7 @@ public: { for(int j = 0; j < static_cast<int>(r.size()); ++j) { - test(r[j] == -j); + test(r[static_cast<size_t>(j)] == -j); } called(); } diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 80fa70cc3c3..7b00e0a421c 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -424,9 +424,9 @@ allTests(Test::TestHelper* helper, bool) test(!oon->a); MultiOptionalPtr mo1 = ICE_MAKE_SHARED(MultiOptional); - mo1->a = 15; + mo1->a = static_cast<Ice::Byte>(15); mo1->b = true; - mo1->c = 19; + mo1->c = static_cast<Ice::Short>(19); mo1->d = 78; mo1->e = 99; mo1->f = 5.5f; @@ -1074,7 +1074,7 @@ allTests(Test::TestHelper* helper, bool) in.read(1, p2); in.read(3, p3); - IceUtil::Optional<Ice::Byte> p4 = 0x08; + IceUtil::Optional<Ice::Byte> p4 = static_cast<Ice::Byte>(0x08); in.read(89, p4); in.endEncapsulation(); diff --git a/cpp/test/Ice/proxy/AllTests.cpp b/cpp/test/Ice/proxy/AllTests.cpp index 147726defb0..a923bf398fb 100644 --- a/cpp/test/Ice/proxy/AllTests.cpp +++ b/cpp/test/Ice/proxy/AllTests.cpp @@ -1155,7 +1155,9 @@ allTests(Test::TestHelper* helper) Ice::ConnectionPtr connection = cl->ice_getConnection(); if(connection) { + test(!cl->ice_isFixed()); Test::MyClassPrxPtr prx = cl->ice_fixed(connection); // Test factory method return type + test(prx->ice_isFixed()); prx->ice_ping(); test(cl->ice_secure(true)->ice_fixed(connection)->ice_isSecure()); test(cl->ice_facet("facet")->ice_fixed(connection)->ice_getFacet() == "facet"); diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp index 04e376c7dc9..4a1a6838f79 100644 --- a/cpp/test/Ice/slicing/objects/AllTests.cpp +++ b/cpp/test/Ice/slicing/objects/AllTests.cpp @@ -571,7 +571,7 @@ public: test(p3->pi == 3); for(int i = 0; i < 300; ++i) { - PCDerived2Ptr p2 = ICE_DYNAMIC_CAST(PCDerived2, p3->pbs[i]); + PCDerived2Ptr p2 = ICE_DYNAMIC_CAST(PCDerived2, p3->pbs[static_cast<size_t>(i)]); test(p2->pi == i); test(p2->pbs.size() == 1); test(!p2->pbs[0]); @@ -2910,7 +2910,7 @@ allTests(Test::TestHelper* helper) test(p3->pi == 3); for(i = 0; i < 300; ++i) { - PCDerived2Ptr p2 = ICE_DYNAMIC_CAST(PCDerived2, p3->pbs[i]); + PCDerived2Ptr p2 = ICE_DYNAMIC_CAST(PCDerived2, p3->pbs[static_cast<size_t>(i)]); test(p2->pi == i); test(p2->pbs.size() == 1); test(!p2->pbs[0]); diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index 6f23a511211..e1c2a282d4f 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -423,7 +423,7 @@ allTests(Test::TestHelper* helper) OptionalClassPtr o = ICE_MAKE_SHARED(OptionalClass); o->bo = false; o->by = 5; - o->sh = 4; + o->sh = static_cast<Ice::Short>(4); o->i = 3; out.write(o); out.writePendingValues(); @@ -451,7 +451,7 @@ allTests(Test::TestHelper* helper) OptionalClassPtr o = ICE_MAKE_SHARED(OptionalClass); o->bo = false; o->by = 5; - o->sh = 4; + o->sh = static_cast<Ice::Short>(4); o->i = 3; out.write(o); out.writePendingValues(); diff --git a/cpp/test/IceGrid/allocation/AllTests.cpp b/cpp/test/IceGrid/allocation/AllTests.cpp index d0a9646372c..3543e07e67c 100644 --- a/cpp/test/IceGrid/allocation/AllTests.cpp +++ b/cpp/test/IceGrid/allocation/AllTests.cpp @@ -133,7 +133,7 @@ public: else { session = _registry->createSession(os.str(), ""); - session->setAllocationTimeout(IceUtilInternal::random(200)); // 200ms timeout + session->setAllocationTimeout(static_cast<Ice::Int>(IceUtilInternal::random(200))); // 200ms timeout } } diff --git a/cpp/test/IceGrid/deployer/AllTests.cpp b/cpp/test/IceGrid/deployer/AllTests.cpp index b8003d3ef83..b4ba1780519 100644 --- a/cpp/test/IceGrid/deployer/AllTests.cpp +++ b/cpp/test/IceGrid/deployer/AllTests.cpp @@ -437,19 +437,15 @@ allTests(Test::TestHelper* helper) { Ice::ObjectPrx obj = query->findObjectByType("::Test"); string id = comm->identityToString(obj->ice_getIdentity()); - test(id == "Server1" || id == "Server2" || id == "SimpleServer" || - id == "IceBox1-Service1" || id == "IceBox1-Service2" || - id == "IceBox2-Service1" || id == "IceBox2-Service2" || - id == "SimpleIceBox-SimpleService" || "ReplicatedObject"); + test(id.find("Server") == 0 || id.find("IceBox") == 0 || + id == "SimpleServer" || id == "SimpleIceBox-SimpleService" || id == "ReplicatedObject"); } { Ice::ObjectPrx obj = query->findObjectByTypeOnLeastLoadedNode("::Test", LoadSample5); string id = comm->identityToString(obj->ice_getIdentity()); - test(id == "Server1" || id == "Server2" || id == "SimpleServer" || - id == "IceBox1-Service1" || id == "IceBox1-Service2" || - id == "IceBox2-Service1" || id == "IceBox2-Service2" || - id == "SimpleIceBox-SimpleService" || "ReplicatedObject"); + test(id.find("Server") == 0 || id.find("IceBox") == 0 || + id == "SimpleServer" || id == "SimpleIceBox-SimpleService" || id == "ReplicatedObject"); } { diff --git a/cpp/test/IceGrid/deployer/application.xml b/cpp/test/IceGrid/deployer/application.xml index 403e51afdf5..ba46b25089c 100644 --- a/cpp/test/IceGrid/deployer/application.xml +++ b/cpp/test/IceGrid/deployer/application.xml @@ -25,8 +25,8 @@ <replica-group id="ReplicatedAdapter 2" proxy-options="-e 1.4"> <description>REPLICA GROUP ${AppVar}</description> - <object identity="ReplicatedObject15" type="::Test" proxy-options="-e 1.5"/> - <object identity="ReplicatedObject14" type="::Test"/> + <object identity="ReplicatedObject15" type="::Test14" proxy-options="-e 1.5"/> + <object identity="ReplicatedObject14" type="::Test15"/> </replica-group> <!-- Variables for variable test --> @@ -110,7 +110,7 @@ <adapter name="Server" endpoints="default"> <description>ADAPTER ${NodeVar}</description> <object identity="${server}" type="::Test"/> - <object identity="cat\/cat/name\/name" type="::Test"/> + <object identity="cat\/cat/name\/name" type="::TestCN"/> <object identity="${ObjectId}" type="::TestId1"/> <object identity="${ObjectCategory1}/${ObjectName1}" type="::TestId2"/> <object identity="${ObjectCategory1}${ObjectIdSlash}${ObjectName1}-bis" type="::TestId3"/> @@ -175,7 +175,7 @@ <server id="LogServer" exe="${server.dir}/server" activation="on-demand" pwd="."> <adapter name="Server" endpoints="default"> - <object identity="${server}" type="::Test"/> + <object identity="${server}" type="::TestLog"/> </adapter> <log path="${server.dir}/log1.txt"/> diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index 964c504d570..256236e8dd0 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -44,7 +44,8 @@ public: vector<string>::const_iterator q = p->second->_stack.begin(); if(p->second->_stack.size() > 10) { - q = p->second->_stack.begin() + p->second->_stack.size() - 10; + q = p->second->_stack.begin() + + static_cast<vector<string>::difference_type>(p->second->_stack.size() - 10); } cerr << "Last 10 updates of observer `" << p->second->_name << "':" << endl; for(; q != p->second->_stack.end(); ++q) diff --git a/cpp/test/IceGrid/update/AllTests.cpp b/cpp/test/IceGrid/update/AllTests.cpp index 56bb9477dc0..9b4b5ce1eea 100644 --- a/cpp/test/IceGrid/update/AllTests.cpp +++ b/cpp/test/IceGrid/update/AllTests.cpp @@ -450,7 +450,6 @@ allTests(Test::TestHelper* helper) try { admin->updateApplication(update); - test(true); } catch(const Ice::Exception& ex) { @@ -490,7 +489,6 @@ allTests(Test::TestHelper* helper) try { admin->updateApplication(update); - test(true); } catch(const Ice::Exception& ex) { diff --git a/cpp/test/IceSSL/configuration/AllTests.cpp b/cpp/test/IceSSL/configuration/AllTests.cpp index 367b7bc8df2..2fcba33ecb1 100644 --- a/cpp/test/IceSSL/configuration/AllTests.cpp +++ b/cpp/test/IceSSL/configuration/AllTests.cpp @@ -91,10 +91,10 @@ readFile(const string& file, vector<char>& buffer) } is.seekg(0, is.end); - buffer.resize(static_cast<int>(is.tellg())); + buffer.resize(static_cast<size_t>(is.tellg())); is.seekg(0, is.beg); - is.read(&buffer[0], buffer.size()); + is.read(&buffer[0], static_cast<streamsize>(buffer.size())); if(!is.good()) { diff --git a/cpp/test/IceStorm/rep1/Publisher.cpp b/cpp/test/IceStorm/rep1/Publisher.cpp index 67746af7429..479d0806f2c 100644 --- a/cpp/test/IceStorm/rep1/Publisher.cpp +++ b/cpp/test/IceStorm/rep1/Publisher.cpp @@ -104,11 +104,11 @@ Publisher::run(int argc, char** argv) os << argv[0] << ": Not enough endpoints in publisher proxy"; throw invalid_argument(os.str()); } - int which = 0; - for(int i = 0; i < 1000; ++i) + size_t which = 0; + for(size_t i = 0; i < 1000; ++i) { - single[which]->event(i); - which = (which + 1) % static_cast<int>(single.size()); + single[which]->event(static_cast<Ice::Int>(i)); + which = (which + 1) % single.size(); } } else diff --git a/cpp/test/IceUtil/sha1/Client.cpp b/cpp/test/IceUtil/sha1/Client.cpp index 62bbb220aeb..1fd53bdd2d0 100644 --- a/cpp/test/IceUtil/sha1/Client.cpp +++ b/cpp/test/IceUtil/sha1/Client.cpp @@ -62,8 +62,7 @@ string toHex(const string& data) { os.width(2); os.fill('0'); - unsigned char c = data[i]; - os << hex << (int)c; + os << hex << (int)static_cast<unsigned char>(data[i]); } return os.str(); } diff --git a/cpp/test/IceUtil/uuid/Client.cpp b/cpp/test/IceUtil/uuid/Client.cpp index 729d5e9e4fb..046c4eb8a01 100644 --- a/cpp/test/IceUtil/uuid/Client.cpp +++ b/cpp/test/IceUtil/uuid/Client.cpp @@ -122,7 +122,7 @@ public: int operator()() { - return IceUtilInternal::random(); + return static_cast<int>(IceUtilInternal::random()); } }; |