-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move colony and list test helpers to new header
- Loading branch information
Showing
3 changed files
with
50 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#pragma once | ||
#ifndef COLONY_LIST_TEST_HELPERS_H | ||
#define 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; | ||
|
||
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 // COLONY_LIST_TEST_HELPERS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters