From 9cef81f47dd41cd57baa8eed298d9a2e49a18f83 Mon Sep 17 00:00:00 2001 From: Adriano dos Santos Fernandes Date: Sun, 12 Jan 2025 14:48:36 -0300 Subject: [PATCH] Fix warnings in test code. --- src/common/classes/tests/ArrayTest.cpp | 18 +++--- .../classes/tests/DoublyLinkedListTest.cpp | 6 +- src/common/tests/StringTest.cpp | 56 +++++++++---------- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/common/classes/tests/ArrayTest.cpp b/src/common/classes/tests/ArrayTest.cpp index 031366f33a..bed187bc46 100644 --- a/src/common/classes/tests/ArrayTest.cpp +++ b/src/common/classes/tests/ArrayTest.cpp @@ -14,7 +14,7 @@ BOOST_AUTO_TEST_CASE(ConstructionWithStdInitializerTest) { Array array(*getDefaultMemoryPool(), {1, 2, 3, 4}); - BOOST_TEST(array.getCount() == 4); + BOOST_TEST(array.getCount() == 4u); BOOST_TEST(array[0] == 1); BOOST_TEST(array[3] == 4); } @@ -23,22 +23,22 @@ BOOST_AUTO_TEST_CASE(ClearTest) { Array array(*getDefaultMemoryPool(), {1, 2, 3, 4}); - BOOST_TEST(array.getCount() == 4); + BOOST_TEST(array.getCount() == 4u); array.clear(); - BOOST_TEST(array.getCount() == 0); + BOOST_TEST(array.getCount() == 0u); } BOOST_AUTO_TEST_CASE(IsEmptyAndHasDataTest) { Array array(*getDefaultMemoryPool(), {1, 2, 3, 4}); - BOOST_TEST(array.getCount() > 0); + BOOST_TEST(array.getCount() > 0u); BOOST_TEST(!array.isEmpty()); BOOST_TEST(array.hasData()); array.clear(); - BOOST_TEST(array.getCount() == 0); + BOOST_TEST(array.getCount() == 0u); BOOST_TEST(array.isEmpty()); BOOST_TEST(!array.hasData()); } @@ -46,12 +46,12 @@ BOOST_AUTO_TEST_CASE(IsEmptyAndHasDataTest) BOOST_AUTO_TEST_CASE(CapacityAndCountTest) { Array array1(10); - BOOST_TEST(array1.getCapacity() == 10); - BOOST_TEST(array1.getCount() == 0); + BOOST_TEST(array1.getCapacity() == 10u); + BOOST_TEST(array1.getCount() == 0u); Array array2(*getDefaultMemoryPool(), 11); - BOOST_TEST(array2.getCapacity() == 11); - BOOST_TEST(array2.getCount() == 0); + BOOST_TEST(array2.getCapacity() == 11u); + BOOST_TEST(array2.getCount() == 0u); } BOOST_AUTO_TEST_SUITE_END() // ArrayTests diff --git a/src/common/classes/tests/DoublyLinkedListTest.cpp b/src/common/classes/tests/DoublyLinkedListTest.cpp index 75f473103a..18a047d3a8 100644 --- a/src/common/classes/tests/DoublyLinkedListTest.cpp +++ b/src/common/classes/tests/DoublyLinkedListTest.cpp @@ -17,7 +17,7 @@ BOOST_AUTO_TEST_CASE(ConstructionWithStdInitializerTest) { DoublyLinkedList list(*getDefaultMemoryPool(), {1, 2, 3, 4}); - BOOST_TEST(list.getCount() == 4); + BOOST_TEST(list.getCount() == 4u); BOOST_TEST(list.front() == 1); BOOST_TEST(list.back() == 4); } @@ -26,10 +26,10 @@ BOOST_AUTO_TEST_CASE(ClearTest) { DoublyLinkedList list(*getDefaultMemoryPool(), {1, 2, 3, 4}); - BOOST_TEST(list.getCount() == 4); + BOOST_TEST(list.getCount() == 4u); list.clear(); - BOOST_TEST(list.getCount() == 0); + BOOST_TEST(list.getCount() == 0u); } BOOST_AUTO_TEST_CASE(SpliceTest) diff --git a/src/common/tests/StringTest.cpp b/src/common/tests/StringTest.cpp index 08c7815f73..7f0b07ddd4 100644 --- a/src/common/tests/StringTest.cpp +++ b/src/common/tests/StringTest.cpp @@ -418,47 +418,47 @@ BOOST_AUTO_TEST_CASE(FindTest) // 9 string b = "345"; - check(a.find(b), 3); - check(a.find("45"), 4); - check(a.find('5'), 5); + check(a.find(b), 3u); + check(a.find("45"), 4u); + check(a.find('5'), 5u); check(a.find("ZZ"), string::npos); - check(a.rfind(b), 9); - check(a.rfind("45"), 10); - check(a.rfind('5'), 11); + check(a.rfind(b), 9u); + check(a.rfind("45"), 10u); + check(a.rfind('5'), 11u); check(a.rfind("ZZ"), string::npos); - check(a.find("45", 8), 10); + check(a.find("45", 8), 10u); - check(a.find_first_of("aub"), 6); - check(a.find_first_of(b), 3); - check(a.find_first_of("54"), 4); - check(a.find_first_of('5'), 5); + check(a.find_first_of("aub"), 6u); + check(a.find_first_of(b), 3u); + check(a.find_first_of("54"), 4u); + check(a.find_first_of('5'), 5u); check(a.find_first_of("ZZ"), string::npos); - check(a.find_last_of("aub"), 8); - check(a.find_last_of(b), 11); - check(a.find_last_of("54"), 11); - check(a.find_last_of('5'), 11); + check(a.find_last_of("aub"), 8u); + check(a.find_last_of(b), 11u); + check(a.find_last_of("54"), 11u); + check(a.find_last_of('5'), 11u); check(a.find_last_of("ZZ"), string::npos); - check(a.find_first_of("45", 8), 10); + check(a.find_first_of("45", 8u), 10u); b = "010"; - check(a.find_first_not_of("aub"), 0); - check(a.find_first_not_of(b), 2); - check(a.find_first_not_of("0102"), 3); - check(a.find_first_not_of('0'), 1); + check(a.find_first_not_of("aub"), 0u); + check(a.find_first_not_of(b), 2u); + check(a.find_first_not_of("0102"), 3u); + check(a.find_first_not_of('0'), 1u); check(a.find_first_not_of(a), string::npos); b = "878"; - check(a.find_last_not_of("aub"), 14); - check(a.find_last_not_of(b), 12); - check(a.find_last_not_of("78"), 12); - check(a.find_last_not_of('8'), 13); + check(a.find_last_not_of("aub"), 14u); + check(a.find_last_not_of(b), 12u); + check(a.find_last_not_of("78"), 12u); + check(a.find_last_not_of('8'), 13u); check(a.find_last_not_of(a), string::npos); - check(a.find_first_not_of("u345", 8), 12); + check(a.find_first_not_of("u345", 8u), 12u); } BOOST_AUTO_TEST_CASE(SubstrTest) @@ -466,13 +466,13 @@ BOOST_AUTO_TEST_CASE(SubstrTest) string a = lbl; string b; - b = a.substr(3, 4); + b = a.substr(3u, 4u); validate(b, "3456"); - b = a.substr(5, 20); + b = a.substr(5u, 20u); validate(b, "56789"); - b = a.substr(50, 20); + b = a.substr(50u, 20u); validate(b, ""); }