Skip to content

Commit

Permalink
Initialize constants constexpr
Browse files Browse the repository at this point in the history
  • Loading branch information
FreePhoenix888 committed Oct 21, 2022
1 parent 5e4edba commit 063f24a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cpp/Platform.Data.Tests/LinksConstantsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
using namespace Platform::Data;
using namespace Platform::Ranges;

TUnsigned unsingedOne = 1;
TUnsigned half = std::numeric_limits<TSigned>::max();
auto constants = LinksConstants<TUnsigned>(Range{unsingedOne, half}, Range{TUnsigned(half + unsingedOne), std::numeric_limits<TUnsigned>::max()});
constexpr TUnsigned unsingedOne = 1;
constexpr TUnsigned half = std::numeric_limits<TSigned>::max();
constexpr LinksConstants<TUnsigned> constants {Range{unsingedOne, half}, Range{TUnsigned(half + unsingedOne), std::numeric_limits<TUnsigned>::max()}};

auto minimum = Hybrid<TUnsigned>(0, true);
auto maximum = Hybrid<TUnsigned>(half, true);

ASSERT_TRUE(IsExternalReference(constants, minimum.Value));
ASSERT_TRUE((IsExternalReference<TUnsigned,constants>(minimum.Value)));
ASSERT_TRUE(minimum.IsExternal());
ASSERT_FALSE(minimum.IsInternal());
ASSERT_TRUE(IsExternalReference(constants, maximum.Value));
ASSERT_TRUE((IsExternalReference<TUnsigned, constants>(maximum.Value)));
ASSERT_TRUE(maximum.IsExternal());
ASSERT_FALSE(maximum.IsInternal());
}
Expand Down

0 comments on commit 063f24a

Please sign in to comment.