From 5eb16eebb3ca8dabb64720fca2fc491bf4f87b6b Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 4 Aug 2022 04:18:19 -0400 Subject: [PATCH] Explicitly cast int literals to int8_t in tests to silence implicit-conversion warnings (#1455) * Explicitly cast int literals to int8_t in tests so silence implicit-conversion warnings Error came from: ``` : error: implicit conversion loses integer precision: 'const int' to 'const signed char' [-Werror,-Wimplicit-int-conversion] ``` * clang format * undo deleted line --- test/benchmark_gtest.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/benchmark_gtest.cc b/test/benchmark_gtest.cc index 3873128e..a6919be3 100644 --- a/test/benchmark_gtest.cc +++ b/test/benchmark_gtest.cc @@ -37,8 +37,9 @@ TEST(AddRangeTest, Advanced64) { TEST(AddRangeTest, FullRange8) { std::vector dst; - AddRange(&dst, int8_t{1}, std::numeric_limits::max(), 8); - EXPECT_THAT(dst, testing::ElementsAre(1, 8, 64, 127)); + AddRange(&dst, int8_t{1}, std::numeric_limits::max(), int8_t{8}); + EXPECT_THAT( + dst, testing::ElementsAre(int8_t{1}, int8_t{8}, int8_t{64}, int8_t{127})); } TEST(AddRangeTest, FullRange64) { @@ -128,8 +129,9 @@ TEST(AddRangeTest, FullNegativeRange64) { TEST(AddRangeTest, Simple8) { std::vector dst; - AddRange(&dst, 1, 8, 2); - EXPECT_THAT(dst, testing::ElementsAre(1, 2, 4, 8)); + AddRange(&dst, int8_t{1}, int8_t{8}, int8_t{2}); + EXPECT_THAT(dst, + testing::ElementsAre(int8_t{1}, int8_t{2}, int8_t{4}, int8_t{8})); } TEST(AddCustomContext, Simple) {