19 #ifndef __STDC_CONSTANT_MACROS 21 #pragma GCC diagnostic push 22 #if __has_warning("-Wreserved-id-macro") 23 #pragma GCC diagnostic ignored "-Wreserved-id-macro" 27 # define __STDC_CONSTANT_MACROS 1 // required by C++ standard 30 #pragma GCC diagnostic pop 35 #define _CRTDBG_MAP_ALLOC 37 #pragma warning(disable : 4996) // 'function': was declared deprecated 40 #if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)) 41 #if defined(__clang__) || (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 42 #pragma GCC diagnostic push 44 #pragma GCC diagnostic ignored "-Weffc++" 47 #include "gtest/gtest.h" 50 #if defined(__clang__) || defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 51 #pragma GCC diagnostic pop 56 #pragma GCC diagnostic ignored "-Wglobal-constructors" 59 template <
typename Ch>
63 return unsigned(
p -
s);
67 inline int StrCmp(
const Ch* s1,
const Ch* s2) {
68 while(*s1 && (*s1 == *s2)) { s1++; s2++; }
69 return static_cast<unsigned>(*s1) <
static_cast<unsigned>(*s2) ? -1 :
static_cast<unsigned>(*s1) >
static_cast<unsigned>(*s2);
72 template <
typename Ch>
74 size_t bufferSize =
sizeof(Ch) * (
StrLen(
str) + 1);
82 filename = tmpnam(filename);
85 if (filename[0] ==
'\\')
86 for (
int i = 0; filename[i] !=
'\0'; i++)
87 filename[i] = filename[i + 1];
89 return fopen(filename,
"wb");
91 strcpy(filename,
"/tmp/fileXXXXXX");
92 int fd = mkstemp(filename);
93 return fdopen(fd,
"w");
99 #pragma warning(disable : 4127) 103 #pragma GCC diagnostic push 104 #if __has_warning("-Wdeprecated") 105 #pragma GCC diagnostic ignored "-Wdeprecated" 117 #pragma GCC diagnostic pop 120 #define RAPIDJSON_ASSERT(x) if (!(x)) throw AssertException(RAPIDJSON_STRINGIFY(x)) 124 Random(
unsigned seed = 0) : mSeed(seed) {}
127 mSeed = 214013 * mSeed + 2531011;
135 #endif // UNITTEST_H_ Ch * StrDup(const Ch *str)
Definition: unittest.h:73
int StrCmp(const Ch *s1, const Ch *s2)
Definition: unittest.h:67
GLuint buffer
Definition: glext.h:6555
char * strcpy(char *to, const char *from)
Definition: compat_ctype.c:124
GLdouble s
Definition: glext.h:6390
Definition: unittest.h:122
unsigned StrLen(const Ch *s)
Definition: unittest.h:60
unsigned operator()()
Definition: unittest.h:126
virtual ~AssertException()
Definition: unittest.cpp:25
Random(unsigned seed=0)
Definition: unittest.h:124
GLfloat GLfloat p
Definition: glext.h:9809
#define FILE
Definition: file_stream_transforms.h:35
FILE * TempFile(char *filename)
Definition: unittest.h:80
AssertException(const AssertException &rhs)
Definition: unittest.h:112
#define fopen
Definition: file_stream_transforms.h:52
unsigned mSeed
Definition: unittest.h:132
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6742
Definition: video4linux2.c:51
AssertException(const char *w)
Definition: unittest.h:111
Definition: unittest.h:109
const char *const str
Definition: portlistingparse.c:18
void * memcpy(void *dst, const void *src, size_t len)
Definition: string.c:26