comparison UnitTestsSources/MemoryCacheTests.cpp @ 2976:cb5d75143da0

Asynchronous generation of ZIP archives and DICOM medias
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 06 Dec 2018 12:23:46 +0100
parents 22524fd06225
children 4e43e67f8ecf
comparison
equal deleted inserted replaced
2970:eea66afed0db 2976:cb5d75143da0
259 second = a.Add(new S("Second item")); 259 second = a.Add(new S("Second item"));
260 260
261 for (int i = 1; i < 100; i++) 261 for (int i = 1; i < 100; i++)
262 { 262 {
263 a.Add(new S("Item " + boost::lexical_cast<std::string>(i))); 263 a.Add(new S("Item " + boost::lexical_cast<std::string>(i)));
264
264 // Continuously protect the two first items 265 // Continuously protect the two first items
265 try { Orthanc::SharedArchive::Accessor(a, first); } catch (Orthanc::OrthancException&) {} 266 {
266 try { Orthanc::SharedArchive::Accessor(a, second); } catch (Orthanc::OrthancException&) {} 267 Orthanc::SharedArchive::Accessor accessor(a, first);
268 ASSERT_TRUE(accessor.IsValid());
269 ASSERT_EQ("First item", dynamic_cast<S&>(accessor.GetItem()).GetValue());
270 }
271
272 {
273 Orthanc::SharedArchive::Accessor accessor(a, second);
274 ASSERT_TRUE(accessor.IsValid());
275 ASSERT_EQ("Second item", dynamic_cast<S&>(accessor.GetItem()).GetValue());
276 }
277
278 {
279 Orthanc::SharedArchive::Accessor accessor(a, "nope");
280 ASSERT_FALSE(accessor.IsValid());
281 ASSERT_THROW(accessor.GetItem(), Orthanc::OrthancException);
282 }
267 } 283 }
268 284
269 std::list<std::string> i; 285 std::list<std::string> i;
270 a.List(i); 286 a.List(i);
271 287