diff options
Diffstat (limited to 'cpp/test')
-rw-r--r-- | cpp/test/Freeze/dbmap/Client.cpp | 54 | ||||
-rw-r--r-- | cpp/test/Freeze/dbmap/Makefile | 2 | ||||
-rw-r--r-- | cpp/test/Freeze/dbmap/dbmap.dsp | 6 |
3 files changed, 58 insertions, 4 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); diff --git a/cpp/test/Freeze/dbmap/Makefile b/cpp/test/Freeze/dbmap/Makefile index 519b298e451..991525f3e48 100644 --- a/cpp/test/Freeze/dbmap/Makefile +++ b/cpp/test/Freeze/dbmap/Makefile @@ -28,7 +28,7 @@ $(CLIENT): $(OBJS) ByteIntMap.h ByteIntMap.cpp: $(SLICE2FREEZE) rm -f ByteIntMap.h ByteIntMap.cpp - $(SLICE2FREEZE) --dict ByteIntMap,byte,int ByteIntMap + $(SLICE2FREEZE) --dict Test::ByteIntMap,byte,int --dict-index Test::ByteIntMap ByteIntMap clean:: rm -f ByteIntMap.h ByteIntMap.cpp diff --git a/cpp/test/Freeze/dbmap/dbmap.dsp b/cpp/test/Freeze/dbmap/dbmap.dsp index c9fba76b9a6..94a7ce4acb4 100644 --- a/cpp/test/Freeze/dbmap/dbmap.dsp +++ b/cpp/test/Freeze/dbmap/dbmap.dsp @@ -120,7 +120,7 @@ USERDEP__DUMMY="..\..\..\bin\slice2freeze.exe" "..\..\..\lib\slice.lib" InputPath=dummy.ice
BuildCmds= \
- ..\..\..\bin\slice2freeze.exe --dict ByteIntMap,byte,int ByteIntMap \
+ ..\..\..\bin\slice2freeze.exe --dict Test::ByteIntMap,byte,int --dict-index Test::ByteIntMap ByteIntMap \
"ByteIntMap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
@@ -137,8 +137,8 @@ USERDEP__DUMMY="..\..\..\bin\slice2freeze.exe" InputPath=dummy.ice
BuildCmds= \
- ..\..\..\bin\slice2freeze.exe --dict ByteIntMap,byte,int ByteIntMap \
-
+ ..\..\..\bin\slice2freeze.exe --dict Test::ByteIntMap,byte,int --dict-index Test::ByteIntMap ByteIntMap \
+
"ByteIntMap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
$(BuildCmds)
|