Mercurial > hg > orthanc
changeset 7218:d8d9cd832569
fix signed comparisons in unit tests
| author | Sebastien Jodogne <s.jodogne@gmail.com> |
|---|---|
| date | Tue, 17 Nov 2026 16:07:55 +0100 |
| parents | 7c82d1dfa0ef |
| children | 5b4659f2474c c4d6bab0e179 |
| files | OrthancFramework/UnitTestsSources/DataSourceTests.cpp OrthancFramework/UnitTestsSources/DicomMapTests.cpp OrthancFramework/UnitTestsSources/FrameworkTests.cpp OrthancFramework/UnitTestsSources/JobsTests.cpp |
| diffstat | 4 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancFramework/UnitTestsSources/DataSourceTests.cpp Tue Nov 17 15:20:51 2026 +0100 +++ b/OrthancFramework/UnitTestsSources/DataSourceTests.cpp Tue Nov 17 16:07:55 2026 +0100 @@ -166,14 +166,14 @@ { std::unique_ptr<DataSourceAnswer::Item> item(reader.ReadSingle(new IntegerIdentifier(false, 10, 0))); ASSERT_TRUE(item.get() != NULL); - ASSERT_EQ(10u, dynamic_cast<const IntegerIdentifier&>(item->GetId()).GetValue()); - ASSERT_EQ(10u, dynamic_cast<const SingleValueObject<int>&>(*item->GetValue()).GetValue()); + ASSERT_EQ(10, dynamic_cast<const IntegerIdentifier&>(item->GetId()).GetValue()); + ASSERT_EQ(10, dynamic_cast<const SingleValueObject<int>&>(*item->GetValue()).GetValue()); } { std::unique_ptr<DataSourceAnswer::Item> item(reader.ReadSingle(new IntegerIdentifier(true, 20, 0))); ASSERT_TRUE(item.get() != NULL); - ASSERT_EQ(20u, dynamic_cast<const IntegerIdentifier&>(item->GetId()).GetValue()); + ASSERT_EQ(20, dynamic_cast<const IntegerIdentifier&>(item->GetId()).GetValue()); bool hasThrown = false;
--- a/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Tue Nov 17 15:20:51 2026 +0100 +++ b/OrthancFramework/UnitTestsSources/DicomMapTests.cpp Tue Nov 17 16:07:55 2026 +0100 @@ -1416,9 +1416,9 @@ memcpy(&f0, decoded.c_str(), sizeof(uint32_t)); memcpy(&f1, decoded.c_str() + sizeof(uint32_t), sizeof(uint32_t)); memcpy(&f2, decoded.c_str() + 2 * sizeof(uint32_t), sizeof(uint32_t)); - ASSERT_EQ(100, f0); - ASSERT_EQ(200, f1); - ASSERT_EQ(300, f2); + ASSERT_EQ(100u, f0); + ASSERT_EQ(200u, f1); + ASSERT_EQ(300u, f2); } #if DCMTK_VERSION_NUMBER >= 365 @@ -1450,9 +1450,9 @@ memcpy(&f0, decoded.c_str(), sizeof(uint64_t)); memcpy(&f1, decoded.c_str() + sizeof(uint64_t), sizeof(uint64_t)); memcpy(&f2, decoded.c_str() + 2 * sizeof(uint64_t), sizeof(uint64_t)); - ASSERT_EQ(100, f0); - ASSERT_EQ(200, f1); - ASSERT_EQ(300, f2); + ASSERT_EQ(100u, f0); + ASSERT_EQ(200u, f1); + ASSERT_EQ(300u, f2); } #endif }
--- a/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Tue Nov 17 15:20:51 2026 +0100 +++ b/OrthancFramework/UnitTestsSources/FrameworkTests.cpp Tue Nov 17 16:07:55 2026 +0100 @@ -580,31 +580,31 @@ { const uint8_t data[] = { 0x24 }; - ASSERT_EQ(0x24, GetUnicode(data, 1, 1)); + ASSERT_EQ(0x24u, GetUnicode(data, 1, 1)); ASSERT_THROW(GetUnicode(data, 0, 1), OrthancException); } { const uint8_t data[] = { 0xc2, 0xa2 }; - ASSERT_EQ(0xa2, GetUnicode(data, 2, 2)); + ASSERT_EQ(0xa2u, GetUnicode(data, 2, 2)); ASSERT_THROW(GetUnicode(data, 1, 2), OrthancException); } { const uint8_t data[] = { 0xe0, 0xa4, 0xb9 }; - ASSERT_EQ(0x0939, GetUnicode(data, 3, 3)); + ASSERT_EQ(0x0939u, GetUnicode(data, 3, 3)); ASSERT_THROW(GetUnicode(data, 2, 3), OrthancException); } { const uint8_t data[] = { 0xe2, 0x82, 0xac }; - ASSERT_EQ(0x20ac, GetUnicode(data, 3, 3)); + ASSERT_EQ(0x20acu, GetUnicode(data, 3, 3)); ASSERT_THROW(GetUnicode(data, 2, 3), OrthancException); } { const uint8_t data[] = { 0xf0, 0x90, 0x8d, 0x88 }; - ASSERT_EQ(0x010348, GetUnicode(data, 4, 4)); + ASSERT_EQ(0x010348u, GetUnicode(data, 4, 4)); ASSERT_THROW(GetUnicode(data, 3, 4), OrthancException); }
--- a/OrthancFramework/UnitTestsSources/JobsTests.cpp Tue Nov 17 15:20:51 2026 +0100 +++ b/OrthancFramework/UnitTestsSources/JobsTests.cpp Tue Nov 17 16:07:55 2026 +0100 @@ -282,7 +282,7 @@ q.Enqueue(new DynamicInteger(30, s)); q.Enqueue(new DynamicInteger(40, s)); - ASSERT_EQ(4, s.size()); + ASSERT_EQ(4u, s.size()); std::unique_ptr<DynamicInteger> i; i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(10, i->GetValue()); @@ -294,7 +294,7 @@ ASSERT_EQ(NULL, q.Dequeue(1)); } - ASSERT_EQ(0, s.size()); + ASSERT_EQ(0u, s.size()); } @@ -306,13 +306,13 @@ SharedMessageQueue q; q.Enqueue(new DynamicInteger(10, s)); q.Enqueue(new DynamicInteger(20, s)); - ASSERT_EQ(2, s.size()); + ASSERT_EQ(2u, s.size()); THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError); } catch (OrthancException&) { // the SharedMessageQueue is destroyed -> make sure the elements have been deleted - ASSERT_EQ(0, s.size()); + ASSERT_EQ(0u, s.size()); } } @@ -336,7 +336,7 @@ i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(0))); ASSERT_EQ(30, i->GetValue()); i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(NULL, i.get()); - ASSERT_EQ(0, s.size()); + ASSERT_EQ(0u, s.size()); } @@ -347,7 +347,7 @@ std::unique_ptr<IDynamicObject> o10(new DynamicInteger(10, s)); std::unique_ptr<IDynamicObject> o20(new DynamicInteger(20, s)); std::unique_ptr<IDynamicObject> o30(new DynamicInteger(30, s)); - ASSERT_EQ(3, s.size()); + ASSERT_EQ(3u, s.size()); std::unique_ptr<DynamicInteger > i; @@ -365,7 +365,7 @@ i.reset(dynamic_cast<DynamicInteger*>(q.Dequeue(1))); ASSERT_EQ(NULL, i.get()); // ensures all objects have been destroyed - ASSERT_EQ(0, s.size()); + ASSERT_EQ(0u, s.size()); } TEST(MultiThreading, BlockingSharedMessageQueueBasicClear) @@ -382,12 +382,12 @@ ASSERT_TRUE(q.Enqueue(o10, 0)); ASSERT_TRUE(q.Enqueue(o20, 1)); - ASSERT_EQ(2, q.GetSize()); + ASSERT_EQ(2u, q.GetSize()); ASSERT_FALSE(q.Enqueue(o30, 1)); - ASSERT_EQ(2, q.GetSize()); + ASSERT_EQ(2u, q.GetSize()); q.Clear(); - ASSERT_EQ(0, q.GetSize()); + ASSERT_EQ(0u, q.GetSize()); ASSERT_TRUE(q.Enqueue(o30, 1)); @@ -406,13 +406,13 @@ q.Enqueue(o10, 0); q.Enqueue(o20, 0); - ASSERT_EQ(2, s.size()); + ASSERT_EQ(2u, s.size()); THROW_WITH_FILE_AND_LINE_INFO(ErrorCode_InternalError); } catch (OrthancException&) { // the BlockingSharedMessageQueue is destroyed -> make sure the elements have been deleted - ASSERT_EQ(0, s.size()); + ASSERT_EQ(0u, s.size()); } }
