diff options
author | Bernard Normier <bernard@zeroc.com> | 2004-09-28 01:11:48 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2004-09-28 01:11:48 +0000 |
commit | 705a304b097d8ed0b58cf147264449203355ec51 (patch) | |
tree | 6dad2cde3699d64cc891ce60e84507e18f30a768 /cpp/test/Freeze/dbmap/Client.cpp | |
parent | make Application abstract (diff) | |
download | ice-705a304b097d8ed0b58cf147264449203355ec51.tar.bz2 ice-705a304b097d8ed0b58cf147264449203355ec51.tar.xz ice-705a304b097d8ed0b58cf147264449203355ec51.zip |
Index support for Freeze dictionaries
Diffstat (limited to 'cpp/test/Freeze/dbmap/Client.cpp')
-rw-r--r-- | cpp/test/Freeze/dbmap/Client.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/cpp/test/Freeze/dbmap/Client.cpp b/cpp/test/Freeze/dbmap/Client.cpp index 54c2b289004..3b83d9de0d8 100644 --- a/cpp/test/Freeze/dbmap/Client.cpp +++ b/cpp/test/Freeze/dbmap/Client.cpp @@ -18,6 +18,7 @@ using namespace std; using namespace Ice; using namespace Freeze; +using namespace Test; // #define SHOW_EXCEPTIONS 1 @@ -485,6 +486,59 @@ run(const CommunicatorPtr& communicator, const string& envName, const string&dbN } cout << "ok" << endl; + cout << "testing index ... " << flush; + m.clear(); + populateDB(connection, m); + + size_t length = alphabet.size(); + for(size_t j = 0; j < length; ++j) + { + p = m.findByValue(static_cast<Int>(j)); + test(p != m.end()); + test(p->first == alphabet[j]); + test(++p == m.end()); + } + + // + // 2 items at 17 + // + m.put(ByteIntMap::value_type(alphabet[21], static_cast<Int>(17))); + + p = m.findByValue(17); + test(p != m.end()); + test(p->first == alphabet[17] || p->first == alphabet[21]); + test(++p != m.end()); + test(p->first == alphabet[17] || p->first == alphabet[21]); + test(++p == m.end()); + test(m.valueCount(17) == 2); + + p = m.findByValue(17); + test(p != m.end()); + m.erase(p); + test(++p != m.end()); + test(p->first == alphabet[17] || p->first == alphabet[21]); + test(++p == m.end()); + test(m.valueCount(17) == 1); + + p = m.findByValue(17); + test(p != m.end()); + test(p->first == alphabet[17] || p->first == alphabet[21]); + + try + { + p.set(18); + test(false); + } + catch(const DatabaseException& ex) + { + // Expected + } + test(p->first == alphabet[17] || p->first == alphabet[21]); + test(++p == m.end()); + test(m.valueCount(17) == 1); + + cout << "ok " << endl; + cout << "testing concurrent access... " << flush; m.clear(); populateDB(connection, m); |