diff options
author | Matthew Newhook <matthew@zeroc.com> | 2001-12-05 19:44:24 +0000 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2001-12-05 19:44:24 +0000 |
commit | e4418f42b61488dd93424f467757acc985c4fce8 (patch) | |
tree | 9acd35f169de1912920954acf13af8e940ded959 /cpp/test/Freeze/dbmap/Client.cpp | |
parent | fixes (diff) | |
download | ice-e4418f42b61488dd93424f467757acc985c4fce8.tar.bz2 ice-e4418f42b61488dd93424f467757acc985c4fce8.tar.xz ice-e4418f42b61488dd93424f467757acc985c4fce8.zip |
Freeze::DBMap updates. Removed DBWrapper, operator[]. Added set method to
the iterator.
Diffstat (limited to 'cpp/test/Freeze/dbmap/Client.cpp')
-rw-r--r-- | cpp/test/Freeze/dbmap/Client.cpp | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index 60685c84cda..b4e444b5ee9 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -206,14 +206,27 @@ run(int argc, char* argv[], const DBPtr& db) cout << "ok" << endl; cout << "testing operator[]... "; - test(m['d'] == 3); + p = m.find('d'); + test(p != m.end() && p->second == 3); test(m.find('a') == m.end()); - test(m['a'] == 0); - test(m.find('a') != m.end()); - m['a'] = 1; - test(m['a'] == 1); - m['a'] = 0; - test(m['a'] == 0); + m.insert(CharIntMap::value_type('a', 1)); + p = m.find('a'); + test(p != m.end() && p->second == 1); + m.insert(CharIntMap::value_type('a', 0)); + p = m.find('a'); + test(p != m.end() && p->second == 0); + cout << "ok" << endl; + + // + // Test writing into an iterator. + // + cout << "testing iterator.set... "; + p = m.find('a'); + test(p != m.end() && p->second == 0); + p.set(1); + test(p != m.end() && p->second == 1); + p = m.find('a'); + test(p != m.end() && p->second == 1); cout << "ok" << endl; // @@ -251,14 +264,14 @@ run(int argc, char* argv[], const DBPtr& db) // order). // j = find(alphabet.begin(), alphabet.end(), 'n'); - vector<CharIntMap::value_type> pairs; - pairs.push_back(CharIntMap::value_type(*j, j - alphabet.begin())); + vector< pair <char, int> > pairs; + pairs.push_back(make_pair(*j, j - alphabet.begin())); ++j; - pairs.push_back(CharIntMap::value_type(*j, j - alphabet.begin())); + pairs.push_back(make_pair(*j, j - alphabet.begin())); ++j; - pairs.push_back(CharIntMap::value_type(*j, j - alphabet.begin())); + pairs.push_back(make_pair(*j, j - alphabet.begin())); ++j; - pairs.push_back(CharIntMap::value_type(*j, j - alphabet.begin())); + pairs.push_back(make_pair(*j, j - alphabet.begin())); p = find_first_of(m.begin(), m.end(), pairs.begin(), pairs.end()); test(p != m.end()); @@ -274,7 +287,7 @@ run(int argc, char* argv[], const DBPtr& db) copy(m.begin(), m.end(), back_inserter(pairs)); test(pairs.size() == m.size()); - vector<CharIntMap::value_type>::const_iterator pit; + vector<pair<char, int> >::const_iterator pit; for (pit = pairs.begin() ; pit != pairs.end() ; ++pit) { p = m.find(pit->first); |