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..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 */ @@ -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); }