Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
unittest.h File Reference
#include "gtest/gtest.h"
#include <stdexcept>
Include dependency graph for unittest.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  AssertException
 
class  Random
 

Macros

#define __STDC_CONSTANT_MACROS   1
 
#define RAPIDJSON_HAS_CXX11_NOEXCEPT   0
 
#define RAPIDJSON_ASSERT(x)
 

Functions

template<typename Ch >
unsigned StrLen (const Ch *s)
 
template<typename Ch >
int StrCmp (const Ch *s1, const Ch *s2)
 
template<typename Ch >
ChStrDup (const Ch *str)
 
FILE * TempFile (char *filename)
 

Macro Definition Documentation

◆ __STDC_CONSTANT_MACROS

#define __STDC_CONSTANT_MACROS   1

Definition at line 27 of file unittest.h.

◆ RAPIDJSON_ASSERT

#define RAPIDJSON_ASSERT ( x)
Value:
(!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u)

Definition at line 124 of file unittest.h.

◆ RAPIDJSON_HAS_CXX11_NOEXCEPT

#define RAPIDJSON_HAS_CXX11_NOEXCEPT   0

Definition at line 121 of file unittest.h.

Function Documentation

◆ StrCmp()

template<typename Ch >
int StrCmp ( const Ch * s1,
const Ch * s2 )
inline

Definition at line 67 of file unittest.h.

67 {
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);
70}
Here is the caller graph for this function:

◆ StrDup()

template<typename Ch >
Ch * StrDup ( const Ch * str)
inline

Definition at line 73 of file unittest.h.

73 {
74 size_t bufferSize = sizeof(Ch) * (StrLen(str) + 1);
75 Ch* buffer = static_cast<Ch*>(malloc(bufferSize));
76 memcpy(buffer, str, bufferSize);
77 return buffer;
78}
#define Ch(x, y, z)
Definition hash_impl.h:17
unsigned StrLen(const Ch *s)
Definition unittest.h:60
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ StrLen()

template<typename Ch >
unsigned StrLen ( const Ch * s)
inline

Definition at line 60 of file unittest.h.

60 {
61 const Ch* p = s;
62 while (*p) p++;
63 return unsigned(p - s);
64}
const mie::Vuint & p
Definition bn.cpp:27
char * s
Here is the caller graph for this function:

◆ TempFile()

FILE * TempFile ( char * filename)
inline

Definition at line 80 of file unittest.h.

80 {
81#if defined(__WIN32__) || defined(_MSC_VER)
82 filename = tmpnam(filename);
83
84 // For Visual Studio, tmpnam() adds a backslash in front. Remove it.
85 if (filename[0] == '\\')
86 for (int i = 0; filename[i] != '\0'; i++)
87 filename[i] = filename[i + 1];
88
89 return fopen(filename, "wb");
90#else
91 strcpy(filename, "/tmp/fileXXXXXX");
92 int fd = mkstemp(filename);
93 return fdopen(fd, "w");
94#endif
95}
Here is the caller graph for this function: