forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
colony_list_test_helpers.h
47 lines (37 loc) · 1.22 KB
/
colony_list_test_helpers.h
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
37
38
39
40
41
42
43
44
45
46
47
#pragma once
#ifndef CATA_TESTS_COLONY_LIST_TEST_HELPERS_H
#define CATA_TESTS_COLONY_LIST_TEST_HELPERS_H
// Fast xorshift+128 random number generator function
// original: https://codingforspeed.com/using-faster-psudo-random-generator-xorshift/
static unsigned int xor_rand()
{
static unsigned int x = 123456789;
static unsigned int y = 362436069;
static unsigned int z = 521288629;
static unsigned int w = 88675123;
const unsigned int t = x ^ ( x << 11 );
// Rotate the static values (w rotation in return statement):
x = y;
y = z;
z = w;
return w = w ^ ( w >> 19 ) ^ ( t ^ ( t >> 8 ) );
}
struct small_struct {
double *empty_field_1;
double unused_number;
unsigned int empty_field2;
double *empty_field_3;
int number;
unsigned int empty_field4;
explicit small_struct( const int num ) noexcept: number( num ) {}
};
struct perfect_forwarding_test {
const bool success;
perfect_forwarding_test( int && /*perfect1*/, int &perfect2 ) : success( true ) {
perfect2 = 1;
}
template <typename T, typename U>
perfect_forwarding_test( T && /*imperfect1*/, U && /*imperfect2*/ ) : success( false )
{}
};
#endif // CATA_TESTS_COLONY_LIST_TEST_HELPERS_H