Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions | Variables
helpers.hpp File Reference
#include <stddef.h>
#include <limits>
#include <random>
#include "gtest/gtest.h"

Go to the source code of this file.

Macros

#define test   TEST
 
#define assert   ASSERT_TRUE
 
#define assertNot   ASSERT_FALSE
 
#define assertThrow   ASSERT_THROW
 
#define assertNothrow   ASSERT_NO_THROW
 
#define assertEq   ASSERT_EQ
 
#define assertNeq   ASSERT_NE
 
#define expect   EXPECT_TRUE
 
#define expectNot   EXPECT_FALSE
 
#define expectThrow   EXPECT_THROW
 
#define expectNothrow   EXPECT_NO_THROW
 
#define expectEq   EXPECT_EQ
 
#define expectNeq   EXPECT_NE
 

Functions

void rndcopy (void *dst, size_t len)
 Copy any number of random bytes into a buffer. More...
 
template<typename R = int>
R rand (R a=std::numeric_limits< R >::min(), R z=std::numeric_limits< R >::max())
 Create a random number. More...
 

Variables

std::default_random_engine trand
 

Macro Definition Documentation

#define assert   ASSERT_TRUE
#define assertEq   ASSERT_EQ
#define assertNeq   ASSERT_NE
#define assertNot   ASSERT_FALSE
#define assertNothrow   ASSERT_NO_THROW
#define assertThrow   ASSERT_THROW
#define expect   EXPECT_TRUE
#define expectEq   EXPECT_EQ
#define expectNeq   EXPECT_NE
#define expectNot   EXPECT_FALSE
#define expectNothrow   EXPECT_NO_THROW
#define expectThrow   EXPECT_THROW
#define test   TEST

Function Documentation

template<typename R = int>
R rand ( R  a = std::numeric_limits<R>::min(),
R  z = std::numeric_limits<R>::max() 
)

Create a random number.

Template Parameters
RThe type of the random number
Parameters
aThe minimum value of the number, by default the minimum number the type supports
zThe maximum value of the number, by default the maximum value the type supports
Returns
A random number of type R between [a; z]

References hmap::d, and trand.

void rndcopy ( void dst,
size_t  len 
)

Copy any number of random bytes into a buffer.

Parameters
dst– The buffer to write to
len– The size of the buffer

References trand.

Variable Documentation

std::default_random_engine trand

Referenced by rand(), and rndcopy().