Skip to content

Commit

Permalink
Make MSVC happy
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Weik committed Sep 21, 2023
1 parent 834a348 commit 2af4806
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/central_moment.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ using nrng::variance;
using nrng::standard_deviation;

TEST_CASE("first central moment") {
auto const values = std::array{1., 2., 3., 4., 5.};
auto const values = std::array{1, 2, 3, 4, 5};

CHECK(central_moment<1>(values) == 0);
CHECK(central_moment<1>(values.begin(), values.end()) == central_moment<1>(values));
}

TEST_CASE("second central moment") {
auto const values = std::array{1., 2., 3., 4., 5.};
auto const values = std::array{1, 2, 3, 4, 5};
auto shift_by_mean = [mu = mean(values)](auto v) { return v - mu; };

CHECK(central_moment<2>(values) == moment<2>(values | std::views::transform(shift_by_mean)));
}

TEST_CASE("variance") {
auto const values = std::array{1., 2., 3., 4., 5.};
auto const values = std::array{1, 2, 3, 4, 5};

CHECK(variance(values) == central_moment<2>(values));
}

TEST_CASE("standard deviation") {
auto const values = std::array{1., 2., 3., 4., 5.};
auto const values = std::array{1, 2, 3, 4, 5};

CHECK(standard_deviation(values) == std::sqrt(variance(values)));
}

0 comments on commit 2af4806

Please sign in to comment.