Skip to content

Commit

Permalink
Resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mingxwa committed Dec 17, 2024
1 parent 3ae4d28 commit a14f027
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/proxy_view_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace proxy_view_tests_details {

struct TestFacade : pro::facade_builder
::add_convention<pro::operator_dispatch<"+=">, void(int)>
::add_convention<utils::spec::FreeToString, std::string() const>
::add_convention<utils::spec::FreeToString, std::string(), std::string() const>
::add_view<TestFacade>
::add_view<const TestFacade>
::build {};
Expand All @@ -32,8 +32,8 @@ static_assert(sizeof(pro::proxy<TestFacade>) == 3 * sizeof(void*));
static_assert(std::is_trivially_copy_constructible_v<pro::proxy_view<TestFacade>>);
static_assert(std::is_trivially_destructible_v<pro::proxy_view<TestFacade>>);
static_assert(SupportsIntPlusEqual<decltype(*std::declval<pro::proxy_view<TestFacade>>())>);
static_assert(!SupportsToString<decltype(*std::declval<pro::proxy_view<TestFacade>>())>);
static_assert(sizeof(pro::proxy_view<TestFacade>) == 2 * sizeof(void*));
static_assert(SupportsToString<decltype(*std::declval<pro::proxy_view<TestFacade>>())>);
static_assert(sizeof(pro::proxy_view<TestFacade>) == 3 * sizeof(void*));

static_assert(std::is_trivially_copy_constructible_v<pro::proxy_view<const TestFacade>>);
static_assert(std::is_trivially_destructible_v<pro::proxy_view<const TestFacade>>);
Expand All @@ -55,6 +55,7 @@ TEST(ProxyViewTests, TestViewIndependentUse) {
int a = 123;
pro::proxy_view<details::TestFacade> p = &a;
*p += 3;
ASSERT_EQ(ToString(*p), "126");
ASSERT_EQ(a, 126);
}

Expand All @@ -78,6 +79,7 @@ TEST(ProxyViewTests, TestViewOfNonOwning) {
*p2 += 3;
ASSERT_EQ(ToString(*p1), "126");
p1.reset();
ASSERT_EQ(ToString(*p2), "126");
ASSERT_EQ(a, 126);
}

Expand Down

0 comments on commit a14f027

Please sign in to comment.