Skip to content

Commit

Permalink
test(cpp): Adjust DrawUniformValuesTest
Browse files Browse the repository at this point in the history
Adjust `DrawUniformValuesTest` to changes made in bdcb025.
  • Loading branch information
TomSchammo committed Oct 28, 2024
1 parent 3399ca4 commit c0b4203
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions cpp/test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,35 @@ TEST(MathUtils, AngleConversionTest) {
}

TEST(Stats, DrawUniformValuesTest) {
constexpr static auto size = 10;
constexpr static auto num_values = 3;
{

constexpr static auto size = 10;
constexpr static auto num_values = 3;

auto values = draw_unique_uniform_values<int>(size, num_values);

auto values = draw_unique_uniform_values<int>(size, num_values);
EXPECT_EQ(values.size(), num_values);

EXPECT_EQ(values.size(), num_values);
for (auto val : values) {
EXPECT_LT(val, size);
EXPECT_GE(val, 0);
}
}

for (auto val : values) {
EXPECT_LT(val, size);
EXPECT_GE(val, 0);
{
constexpr static auto size = 3;
constexpr static auto num_values = 10;

EXPECT_THROW(
{
try {
auto values = draw_unique_uniform_values<int>(size, num_values);
} catch (const std::invalid_argument &e) {
EXPECT_STREQ("num_values cannot exceed size.", e.what());
throw;
}
},
std::invalid_argument);
}
}

Expand Down

0 comments on commit c0b4203

Please sign in to comment.