clang-tidy: use auto

Found with modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2021-05-13 17:56:43 -07:00
committed by Luis Díaz Más
parent 20dfab8036
commit b8712188bb
41 changed files with 167 additions and 170 deletions
+3 -3
View File
@@ -161,7 +161,7 @@ TEST(base64encode, encodesValidString)
const std::string original ("This is a unit test");
const std::string expected ("VGhpcyBpcyBhIHVuaXQgdGVzdA==");
size_t encodeLength = ((original.size() + 2) / 3) * 4 + 1;
char * result = new char [encodeLength];
auto result = new char[encodeLength];
ASSERT_EQ(1, base64encode(original.c_str(), original.size(), result, encodeLength));
ASSERT_STREQ(expected.c_str(), result);
delete [] result;
@@ -171,7 +171,7 @@ TEST(base64encode, doesNotEncodeWithNotBigEnoughResultSize)
{
const std::string original ("This is a unit test");
size_t encodeLength = (original.size());
char * result = new char [encodeLength];
auto result = new char[encodeLength];
ASSERT_EQ(0, base64encode(original.c_str(), original.size(), result, encodeLength));
delete [] result;
}
@@ -180,7 +180,7 @@ TEST(base64decode, decodesValidString)
{
const std::string original ("VGhpcyBpcyBhIHVuaXQgdGVzdA==");
const std::string expected ("This is a unit test");
char * result = new char [original.size()];
auto result = new char[original.size()];
ASSERT_EQ(static_cast<long>(expected.size()),
base64decode(original.c_str(), result, original.size()));
ASSERT_STREQ(expected.c_str(), result);