Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
helpers.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stddef.h> // for size_t
4 #include <limits> // for numeric_limits
5 #include <random> // for default_random_engine, uniform_int_distribu...
6 
7 #include "gtest/gtest.h" // for ASSERT_EQ, ASSERT_FALSE, ASSERT_NE, ASSERT_...
8 
9 #define test TEST
10 
11 #undef assert // Ignore assert.h asserts
12 #define assert ASSERT_TRUE
13 #define assertNot ASSERT_FALSE
14 #define assertThrow ASSERT_THROW
15 #define assertNothrow ASSERT_NO_THROW
16 #define assertEq ASSERT_EQ
17 #define assertNeq ASSERT_NE
18 
19 #define expect EXPECT_TRUE
20 #define expectNot EXPECT_FALSE
21 #define expectThrow EXPECT_THROW
22 #define expectNothrow EXPECT_NO_THROW
23 #define expectEq EXPECT_EQ
24 #define expectNeq EXPECT_NE
25 
26 // TODO: Seed?
27 extern std::default_random_engine trand;
28 
33 void rndcopy(void *dst, size_t len);
34 
43 template <typename R=int>
46  std::uniform_int_distribution<R> d(a,z);
47  return d(trand);
48 }
49 
50 
const T & max(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:224
void rndcopy(void *dst, size_t len)
Copy any number of random bytes into a buffer.
Definition: helpers.cpp:9
const int R[3]
Definition: geom.hpp:1221
R rand(R a=std::numeric_limits< R >::min(), R z=std::numeric_limits< R >::max())
Create a random number.
Definition: helpers.hpp:44
std::default_random_engine trand
Definition: helpers.cpp:7
const T & min(const inexor::rpc::SharedVar< T > &a, const T &b)
Definition: SharedVar.hpp:210
int d
Definition: octaedit.cpp:1749