Fix sign conversion warnings in LLDB Python unittests
llvm-svn: 259689
This commit is contained in:
@@ -244,7 +244,6 @@ TEST_F(PythonDataObjectsTest, TestPythonString)
|
||||
|
||||
static const char *test_string = "PythonDataObjectsTest::TestPythonString1";
|
||||
static const char *test_string2 = "PythonDataObjectsTest::TestPythonString2";
|
||||
static const char *test_string3 = "PythonDataObjectsTest::TestPythonString3";
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
// Verify that `PythonString` works correctly when given a PyString object.
|
||||
@@ -266,8 +265,8 @@ TEST_F(PythonDataObjectsTest, TestPythonString)
|
||||
|
||||
// Test that creating a `PythonString` object works correctly with the
|
||||
// string constructor
|
||||
PythonString constructed_string(test_string3);
|
||||
EXPECT_STREQ(test_string3, constructed_string.GetString().str().c_str());
|
||||
PythonString constructed_string(test_string2);
|
||||
EXPECT_STREQ(test_string2, constructed_string.GetString().str().c_str());
|
||||
}
|
||||
|
||||
TEST_F(PythonDataObjectsTest, TestPythonStringToStr)
|
||||
@@ -289,7 +288,7 @@ TEST_F(PythonDataObjectsTest, TestPythonIntegerToStructuredInteger)
|
||||
{
|
||||
PythonInteger integer(7);
|
||||
auto int_sp = integer.CreateStructuredInteger();
|
||||
EXPECT_EQ(7, int_sp->GetValue());
|
||||
EXPECT_EQ(7U, int_sp->GetValue());
|
||||
}
|
||||
|
||||
TEST_F(PythonDataObjectsTest, TestPythonStringToStructuredString)
|
||||
@@ -304,7 +303,7 @@ TEST_F(PythonDataObjectsTest, TestPythonListValueEquality)
|
||||
{
|
||||
// Test that a list which is built through the native
|
||||
// Python API behaves correctly when wrapped by a PythonList.
|
||||
static const int list_size = 2;
|
||||
static const unsigned list_size = 2;
|
||||
static const long long_value0 = 5;
|
||||
static const char *const string_value1 = "String Index 1";
|
||||
|
||||
@@ -316,7 +315,7 @@ TEST_F(PythonDataObjectsTest, TestPythonListValueEquality)
|
||||
list_items[0].Reset(PythonInteger(long_value0));
|
||||
list_items[1].Reset(PythonString(string_value1));
|
||||
|
||||
for (int i = 0; i < list_size; ++i)
|
||||
for (unsigned i = 0; i < list_size; ++i)
|
||||
list.SetItemAtIndex(i, list_items[i]);
|
||||
|
||||
EXPECT_EQ(list_size, list.GetSize());
|
||||
@@ -349,7 +348,7 @@ TEST_F(PythonDataObjectsTest, TestPythonListManipulation)
|
||||
|
||||
list.AppendItem(integer);
|
||||
list.AppendItem(string);
|
||||
EXPECT_EQ(2, list.GetSize());
|
||||
EXPECT_EQ(2U, list.GetSize());
|
||||
|
||||
// Verify that the values match
|
||||
PythonObject chk_value1 = list.GetItemAtIndex(0);
|
||||
@@ -380,17 +379,17 @@ TEST_F(PythonDataObjectsTest, TestPythonListToStructuredList)
|
||||
auto int_sp = array_sp->GetItemAtIndex(0)->GetAsInteger();
|
||||
auto string_sp = array_sp->GetItemAtIndex(1)->GetAsString();
|
||||
|
||||
EXPECT_EQ(long_value0, int_sp->GetValue());
|
||||
EXPECT_EQ(long_value0, long(int_sp->GetValue()));
|
||||
EXPECT_STREQ(string_value1, string_sp->GetValue().c_str());
|
||||
}
|
||||
|
||||
TEST_F(PythonDataObjectsTest, TestPythonTupleSize)
|
||||
{
|
||||
PythonTuple tuple(PyInitialValue::Empty);
|
||||
EXPECT_EQ(0, tuple.GetSize());
|
||||
EXPECT_EQ(0U, tuple.GetSize());
|
||||
|
||||
tuple = PythonTuple(3);
|
||||
EXPECT_EQ(3, tuple.GetSize());
|
||||
EXPECT_EQ(3U, tuple.GetSize());
|
||||
}
|
||||
|
||||
TEST_F(PythonDataObjectsTest, TestPythonTupleValues)
|
||||
@@ -416,7 +415,7 @@ TEST_F(PythonDataObjectsTest, TestPythonTupleInitializerList)
|
||||
PythonString string_value("Test");
|
||||
PythonObject none_value(PyRefType::Borrowed, Py_None);
|
||||
PythonTuple tuple{ int_value, string_value, none_value };
|
||||
EXPECT_EQ(3, tuple.GetSize());
|
||||
EXPECT_EQ(3U, tuple.GetSize());
|
||||
|
||||
EXPECT_EQ(tuple.GetItemAtIndex(0).get(), int_value.get());
|
||||
EXPECT_EQ(tuple.GetItemAtIndex(1).get(), string_value.get());
|
||||
@@ -430,7 +429,7 @@ TEST_F(PythonDataObjectsTest, TestPythonTupleInitializerList2)
|
||||
PythonObject none_value(PyRefType::Borrowed, Py_None);
|
||||
|
||||
PythonTuple tuple{ int_value.get(), string_value.get(), none_value.get() };
|
||||
EXPECT_EQ(3, tuple.GetSize());
|
||||
EXPECT_EQ(3U, tuple.GetSize());
|
||||
|
||||
EXPECT_EQ(tuple.GetItemAtIndex(0).get(), int_value.get());
|
||||
EXPECT_EQ(tuple.GetItemAtIndex(1).get(), string_value.get());
|
||||
@@ -454,7 +453,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryValueEquality)
|
||||
{
|
||||
// Test that a dictionary which is built through the native
|
||||
// Python API behaves correctly when wrapped by a PythonDictionary.
|
||||
static const int dict_entries = 2;
|
||||
static const unsigned dict_entries = 2;
|
||||
const char *key_0 = "Key 0";
|
||||
int key_1 = 1;
|
||||
const int value_0 = 0;
|
||||
@@ -472,7 +471,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryValueEquality)
|
||||
EXPECT_TRUE(PythonDictionary::Check(py_dict));
|
||||
PythonDictionary dict(PyRefType::Owned, py_dict);
|
||||
|
||||
for (int i = 0; i < dict_entries; ++i)
|
||||
for (unsigned i = 0; i < dict_entries; ++i)
|
||||
PyDict_SetItem(py_dict, py_keys[i].get(), py_values[i].get());
|
||||
EXPECT_EQ(dict.GetSize(), dict_entries);
|
||||
EXPECT_EQ(PyObjectType::Dictionary, dict.GetObjectType());
|
||||
@@ -494,7 +493,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryManipulation)
|
||||
{
|
||||
// Test that manipulation of a dictionary behaves correctly when wrapped
|
||||
// by a PythonDictionary.
|
||||
static const int dict_entries = 2;
|
||||
static const unsigned dict_entries = 2;
|
||||
|
||||
const char *const key_0 = "Key 0";
|
||||
const char *const key_1 = "Key 1";
|
||||
@@ -541,7 +540,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryToStructuredDictionary)
|
||||
dict.SetItemForKey(PythonString(string_key1), PythonInteger(int_value1));
|
||||
|
||||
auto dict_sp = dict.CreateStructuredDictionary();
|
||||
EXPECT_EQ(2, dict_sp->GetSize());
|
||||
EXPECT_EQ(2U, dict_sp->GetSize());
|
||||
|
||||
EXPECT_TRUE(dict_sp->HasKey(string_key0));
|
||||
EXPECT_TRUE(dict_sp->HasKey(string_key1));
|
||||
@@ -550,7 +549,7 @@ TEST_F(PythonDataObjectsTest, TestPythonDictionaryToStructuredDictionary)
|
||||
auto int_sp = dict_sp->GetValueForKey(string_key1)->GetAsInteger();
|
||||
|
||||
EXPECT_STREQ(string_value0, string_sp->GetValue().c_str());
|
||||
EXPECT_EQ(int_value1, int_sp->GetValue());
|
||||
EXPECT_EQ(int_value1, long(int_sp->GetValue()));
|
||||
}
|
||||
|
||||
TEST_F(PythonDataObjectsTest, TestPythonCallableCheck)
|
||||
@@ -574,7 +573,7 @@ TEST_F(PythonDataObjectsTest, TestPythonCallableInvoke)
|
||||
|
||||
EXPECT_TRUE(PythonList::Check(result.get()));
|
||||
auto list_result = result.AsType<PythonList>();
|
||||
EXPECT_EQ(3, list_result.GetSize());
|
||||
EXPECT_EQ(3U, list_result.GetSize());
|
||||
EXPECT_EQ(one.get(), list_result.GetItemAtIndex(0).get());
|
||||
EXPECT_EQ(two.get(), list_result.GetItemAtIndex(1).get());
|
||||
EXPECT_EQ(three.get(), list_result.GetItemAtIndex(2).get());
|
||||
@@ -596,4 +595,4 @@ TEST_F(PythonDataObjectsTest, TestObjectAttributes)
|
||||
PythonInteger numerator_attr = py_int.GetAttributeValue("numerator").AsType<PythonInteger>();
|
||||
EXPECT_TRUE(numerator_attr.IsAllocated());
|
||||
EXPECT_EQ(42, numerator_attr.GetInteger());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user