Skip to content

Commit

Permalink
[#490] Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
orecham committed Nov 7, 2024
1 parent 9a25cbc commit 23b5be2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions iceoryx2-ffi/cxx/tests/src/slice_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "iox/slice.hpp"
#include "test.hpp"

#include <array>

namespace {

struct DummyData {
Expand All @@ -27,25 +29,25 @@ TEST(SliceTest, const_correctness_is_maintained) {

auto elements = std::array<DummyData, SLICE_MAX_LENGTH> {};

auto mutable_slice = iox::MutableSlice<DummyData>(elements.begin(), SLICE_MAX_LENGTH);
auto mutable_slice = iox::MutableSlice<DummyData>(elements.data(), SLICE_MAX_LENGTH);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(mutable_slice.begin())>>);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(mutable_slice.end())>>);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(mutable_slice.data())>>);
ASSERT_FALSE(std::is_const_v<std::remove_reference_t<decltype(mutable_slice[0])>>);

const auto const_mutable_slice = iox::MutableSlice<DummyData>(elements.begin(), SLICE_MAX_LENGTH);
const auto const_mutable_slice = iox::MutableSlice<DummyData>(elements.data(), SLICE_MAX_LENGTH);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(const_mutable_slice.begin())>>);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(const_mutable_slice.end())>>);
ASSERT_FALSE(std::is_const_v<std::remove_pointer_t<decltype(const_mutable_slice.data())>>);
ASSERT_FALSE(std::is_const_v<std::remove_reference_t<decltype(const_mutable_slice[0])>>);

auto immutable_slice = iox::ImmutableSlice<DummyData>(elements.begin(), SLICE_MAX_LENGTH);
auto immutable_slice = iox::ImmutableSlice<DummyData>(elements.data(), SLICE_MAX_LENGTH);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(immutable_slice.begin())>>);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(immutable_slice.end())>>);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(immutable_slice.data())>>);
ASSERT_TRUE(std::is_const_v<std::remove_reference_t<decltype(immutable_slice[0])>>);

const auto const_immutable_slice = iox::ImmutableSlice<DummyData>(elements.begin(), SLICE_MAX_LENGTH);
const auto const_immutable_slice = iox::ImmutableSlice<DummyData>(elements.data(), SLICE_MAX_LENGTH);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(const_immutable_slice.begin())>>);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(const_immutable_slice.end())>>);
ASSERT_TRUE(std::is_const_v<std::remove_pointer_t<decltype(const_immutable_slice.data())>>);
Expand Down

0 comments on commit 23b5be2

Please sign in to comment.