IntMultiset multiplyMultiset(const IntMultiset& s, int f) { IntMultiset ret; for (IntMultiset::const_iterator it = s.begin(); it != s.end(); ++it) ret.insert(*it * f); return ret; }
//////////////////////////////////////////////////////////// // Multiset // void Multiset() { _server->registerMethod("multiplyset", *this, &BinRpcTest::multiplyMultiset); cxxtools::bin::RpcClient client(_loop, "", _port); cxxtools::RemoteProcedure<IntMultiset, IntMultiset, int> multiply(client, "multiplyset"); IntMultiset myset; myset.insert(4); myset.insert(5); myset.insert(11); myset.insert(5); multiply.begin(myset, 2); const IntMultiset& v = multiply.end(2000); CXXTOOLS_UNIT_ASSERT_EQUALS(v.size(), 4); CXXTOOLS_UNIT_ASSERT_EQUALS(v.count(8), 1); CXXTOOLS_UNIT_ASSERT_EQUALS(v.count(10), 2); CXXTOOLS_UNIT_ASSERT_EQUALS(v.count(22), 1); }
bool Init() { int nRandom = 0; for (int i = 0; i < g_nMax; ++i) { nRandom = i; g_nSummary += nRandom; g_dInts.push_back(nRandom); g_hmInts.insert(std::make_pair(nRandom, nRandom)); g_hsInts.insert(nRandom); g_lInts.push_back(nRandom); g_mInts.insert(std::make_pair(nRandom, nRandom)); g_mmInts.insert(std::make_pair(nRandom, nRandom)); g_msInts.insert(nRandom); g_sInts.insert(nRandom); g_vInts.push_back(nRandom); } return true; }