From 3b1f555b58c33376186cbee7adf616b9a81c6726 Mon Sep 17 00:00:00 2001 From: Peter Harris Date: Fri, 24 Jan 2025 14:45:24 +0000 Subject: [PATCH 1/2] Fix ambiguous constructor --- hwcpipe/include/hwcpipe/sampler.hpp | 4 ++-- test/counter-sampler.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hwcpipe/include/hwcpipe/sampler.hpp b/hwcpipe/include/hwcpipe/sampler.hpp index b50b660..9638041 100644 --- a/hwcpipe/include/hwcpipe/sampler.hpp +++ b/hwcpipe/include/hwcpipe/sampler.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Arm Limited. + * Copyright (c) 2023-2025 Arm Limited. * * SPDX-License-Identifier: MIT */ @@ -75,7 +75,7 @@ struct counter_sample { /** Default constructor */ counter_sample() - : counter_sample(hwcpipe_counter(), 0, 0UL) {} + : counter_sample(hwcpipe_counter(), 0, static_cast(0UL)) {} }; /** diff --git a/test/counter-sampler.cpp b/test/counter-sampler.cpp index eecf824..f833f13 100644 --- a/test/counter-sampler.cpp +++ b/test/counter-sampler.cpp @@ -44,12 +44,22 @@ struct hwcpipe_sampler_mock_policy { using namespace hwcpipe::mock; using sampler_t = hwcpipe::sampler; +TEST_CASE("counter_sampler__DefaultConstructor") { + SECTION("uint64") { + counter_sample sample; + + REQUIRE(sample.timestamp == 0); + REQUIRE(sample.value.uint64 == static_cast(0UL)); + REQUIRE(sample.type == counter_sample::type::uint64); + } +} + TEST_CASE("counter_sampler__CorrectTypesAreAssigned") { SECTION("uint64") { - counter_sample sample{hwcpipe_counter(), 0xbaadcafe, 42UL}; + counter_sample sample{hwcpipe_counter(), 0xbaadcafe, static_cast(42UL)}; REQUIRE(sample.timestamp == 0xbaadcafe); - REQUIRE(sample.value.uint64 == 42); + REQUIRE(sample.value.uint64 == static_cast(42)); REQUIRE(sample.type == counter_sample::type::uint64); } From 002f6b5b3d0be326b27ed505b3ef08ee7f931052 Mon Sep 17 00:00:00 2001 From: Peter Harris Date: Fri, 24 Jan 2025 14:55:00 +0000 Subject: [PATCH 2/2] Fix copyright --- test/counter-sampler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/counter-sampler.cpp b/test/counter-sampler.cpp index f833f13..d97f0c7 100644 --- a/test/counter-sampler.cpp +++ b/test/counter-sampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Arm Limited. + * Copyright (c) 2023-2025 Arm Limited. * * SPDX-License-Identifier: MIT */