Googletest export

Use standard C++11 integer types in gtest-port.h.

Remove testing::internal::{Int,Uint}{32,64} in favor of types
guaranteed to be in <cstdint> since C++11.

Tests for built-in integer type coverage are switched from
{Int,Uint}64 to [unsigned] long long, which is guaranteed by
C++11 to exist and be at least 64-bit wide.

PiperOrigin-RevId: 281565263
This commit is contained in:
Abseil Team
2019-11-20 14:36:06 -05:00
committed by Gennadiy Civil
parent 200ff59949
commit 717ce7feb8
14 changed files with 138 additions and 161 deletions

View File

@@ -53,6 +53,7 @@
#include <ctype.h>
#include <float.h>
#include <string.h>
#include <cstdint>
#include <iomanip>
#include <limits>
#include <map>
@@ -842,18 +843,18 @@ struct GTEST_API_ TrueWithString {
// but it's good enough for our purposes.
class GTEST_API_ Random {
public:
static const UInt32 kMaxRange = 1u << 31;
static const uint32_t kMaxRange = 1u << 31;
explicit Random(UInt32 seed) : state_(seed) {}
explicit Random(uint32_t seed) : state_(seed) {}
void Reseed(UInt32 seed) { state_ = seed; }
void Reseed(uint32_t seed) { state_ = seed; }
// Generates a random number from [0, range). Crashes if 'range' is
// 0 or greater than kMaxRange.
UInt32 Generate(UInt32 range);
uint32_t Generate(uint32_t range);
private:
UInt32 state_;
uint32_t state_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(Random);
};