Skip to content

Commit

Permalink
add more random tests
Browse files Browse the repository at this point in the history
  • Loading branch information
annihilatorq committed Oct 17, 2024
1 parent 465e1f7 commit 78ce1af
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/tests/random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,11 @@ TEST(random, basics) {
EXPECT_EQ(rnd::number<uint32_t>(50, 100), 96);
EXPECT_EQ(rnd::number<uint32_t>(50, 100), 70);
EXPECT_EQ(rnd::number<uint32_t>(50, 100), 93);

std::vector<int> vec = {10, 20, 30, 40, 50};
EXPECT_EQ(rnd::item(vec), 10);

std::array<int, 5> arr = {100, 200, 300, 400, 500};
EXPECT_EQ(rnd::item(arr), 400);
EXPECT_EQ(rnd::item(std::span<int>(arr)), 200);
}

0 comments on commit 78ce1af

Please sign in to comment.