forked from KnightKingWalk/KnightKing
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_util.cpp
More file actions
36 lines (30 loc) · 810 Bytes
/
test_util.cpp
File metadata and controls
36 lines (30 loc) · 810 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <gtest/gtest.h>
#include "test.hpp"
#include <kklib/mpi_helper.hpp>
#include <kklib/util.hpp>
TEST(RandomEngine, integral)
{
constexpr int min = 1;
constexpr int max = 5;
kklib::RandomEngine<int> engine{};
EXPECT_NO_THROW(engine(min, max));
unsigned int const result = engine(min, max);
EXPECT_GE(result, min);
EXPECT_LE(result, max);
}
TEST(RandomEngine, floating_point)
{
constexpr auto min = 1.f;
constexpr auto max = 5.f;
kklib::RandomEngine<float> engine{};
EXPECT_NO_THROW(engine(min, max));
unsigned int const result = engine(min, max);
EXPECT_GE(result, min);
EXPECT_LE(result, max);
}
GTEST_API_ int main(int argc, char* argv[])
{
::testing::InitGoogleTest(&argc, argv);
int result = RUN_ALL_TESTS();
return result;
}