[libc-commits] [libc] 3d515cb - [libc][NFC][Obvious] Compare against size_t values in ArrayRef tests.
Siva Chandra Reddy via libc-commits
libc-commits at lists.llvm.org
Tue Jun 8 17:19:06 PDT 2021
Author: Siva Chandra Reddy
Date: 2021-06-09T00:14:05Z
New Revision: 3d515cb185d86d8f89fe60a4e5ef2a6278baa368
URL: https://github.com/llvm/llvm-project/commit/3d515cb185d86d8f89fe60a4e5ef2a6278baa368
DIFF: https://github.com/llvm/llvm-project/commit/3d515cb185d86d8f89fe60a4e5ef2a6278baa368.diff
LOG: [libc][NFC][Obvious] Compare against size_t values in ArrayRef tests.
Different platforms treat size_t differently so we should compare sizes
of ArrayRef objects with size_t values (instead of the current unsigned
long values.)
Added:
Modified:
libc/test/utils/CPP/arrayref_test.cpp
Removed:
################################################################################
diff --git a/libc/test/utils/CPP/arrayref_test.cpp b/libc/test/utils/CPP/arrayref_test.cpp
index f3b37b41ac71f..83dda9675c7be 100644
--- a/libc/test/utils/CPP/arrayref_test.cpp
+++ b/libc/test/utils/CPP/arrayref_test.cpp
@@ -21,7 +21,7 @@ TYPED_TEST(LlvmLibcArrayRefTest, ConstructFromElement, Types) {
value_type element = 5;
ParamType arrayref(element);
EXPECT_FALSE(arrayref.empty());
- EXPECT_EQ(arrayref.size(), 1UL);
+ EXPECT_EQ(arrayref.size(), size_t(1));
EXPECT_EQ(arrayref[0], 5);
EXPECT_EQ((const_pointer)arrayref.data(), (const_pointer)&element);
}
@@ -32,7 +32,7 @@ TYPED_TEST(LlvmLibcArrayRefTest, ConstructFromPointerAndSize, Types) {
value_type values[] = {1, 2};
ParamType arrayref(values, 2);
EXPECT_FALSE(arrayref.empty());
- EXPECT_EQ(arrayref.size(), 2UL);
+ EXPECT_EQ(arrayref.size(), size_t(2));
EXPECT_EQ(arrayref[0], 1);
EXPECT_EQ(arrayref[1], 2);
EXPECT_EQ((const_pointer)arrayref.data(), (const_pointer)values);
@@ -44,7 +44,7 @@ TYPED_TEST(LlvmLibcArrayRefTest, ConstructFromIterator, Types) {
value_type values[] = {1, 2};
ParamType arrayref(&values[0], &values[2]);
EXPECT_FALSE(arrayref.empty());
- EXPECT_EQ(arrayref.size(), 2UL);
+ EXPECT_EQ(arrayref.size(), size_t(2));
EXPECT_EQ(arrayref[0], 1);
EXPECT_EQ(arrayref[1], 2);
EXPECT_EQ((const_pointer)arrayref.data(), (const_pointer)&values[0]);
@@ -56,7 +56,7 @@ TYPED_TEST(LlvmLibcArrayRefTest, ConstructFromCArray, Types) {
value_type values[] = {1, 2};
ParamType arrayref(values);
EXPECT_FALSE(arrayref.empty());
- EXPECT_EQ(arrayref.size(), 2UL);
+ EXPECT_EQ(arrayref.size(), size_t(2));
EXPECT_EQ(arrayref[0], 1);
EXPECT_EQ(arrayref[1], 2);
EXPECT_EQ((const_pointer)arrayref.data(), (const_pointer)values);
@@ -68,7 +68,7 @@ TYPED_TEST(LlvmLibcArrayRefTest, ConstructFromLibcArray, Types) {
Array<value_type, 2> values = {1, 2};
ParamType arrayref(values);
EXPECT_FALSE(arrayref.empty());
- EXPECT_EQ(arrayref.size(), 2UL);
+ EXPECT_EQ(arrayref.size(), size_t(2));
EXPECT_EQ(arrayref[0], 1);
EXPECT_EQ(arrayref[1], 2);
EXPECT_EQ((const_pointer)arrayref.data(), (const_pointer)values.data());
More information about the libc-commits
mailing list