Mercurial > hg > orthanc
diff UnitTestsSources/main.cpp @ 723:0da078f3affc
multithreading tests
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 18 Feb 2014 16:18:42 +0100 |
parents | 38e2883e096f |
children |
line wrap: on
line diff
--- a/UnitTestsSources/main.cpp Fri Feb 14 16:12:44 2014 +0100 +++ b/UnitTestsSources/main.cpp Tue Feb 18 16:18:42 2014 +0100 @@ -12,7 +12,6 @@ #include "../Core/Uuid.h" #include "../OrthancServer/FromDcmtkBridge.h" #include "../OrthancServer/OrthancInitialization.h" -#include "../Core/MultiThreading/SharedMessageQueue.h" using namespace Orthanc; @@ -498,59 +497,6 @@ -class DynamicInteger : public IDynamicObject -{ -private: - int value_; - -public: - DynamicInteger(int value) : value_(value) - { - } - - int GetValue() const - { - return value_; - } -}; - - -TEST(SharedMessageQueue, Basic) -{ - SharedMessageQueue q; - ASSERT_TRUE(q.WaitEmpty(0)); - q.Enqueue(new DynamicInteger(10)); - ASSERT_FALSE(q.WaitEmpty(1)); - q.Enqueue(new DynamicInteger(20)); - q.Enqueue(new DynamicInteger(30)); - q.Enqueue(new DynamicInteger(40)); - - std::auto_ptr<DynamicInteger> i; - i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(10, i->GetValue()); - i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(20, i->GetValue()); - i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(30, i->GetValue()); - ASSERT_FALSE(q.WaitEmpty(1)); - i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(40, i->GetValue()); - ASSERT_TRUE(q.WaitEmpty(0)); - ASSERT_EQ(NULL, q.Dequeue(1)); -} - - -TEST(SharedMessageQueue, Clean) -{ - try - { - SharedMessageQueue q; - q.Enqueue(new DynamicInteger(10)); - q.Enqueue(new DynamicInteger(20)); - throw OrthancException("Nope"); - } - catch (OrthancException&) - { - } -} - - TEST(Toolbox, WriteFile) { std::string path;