40 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ 41 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ 202 # include <sys/types.h> 203 # include <sys/stat.h> 204 #endif // !_WIN32_WCE 206 #if defined __APPLE__ 207 # include <AvailabilityMacros.h> 208 # include <TargetConditionals.h> 215 #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" 216 #define GTEST_FLAG_PREFIX_ "gtest_" 217 #define GTEST_FLAG_PREFIX_DASH_ "gtest-" 218 #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" 219 #define GTEST_NAME_ "Google Test" 220 #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" 225 # define GTEST_GCC_VER_ \ 226 (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) 231 # define GTEST_OS_CYGWIN 1 232 #elif defined __SYMBIAN32__ 233 # define GTEST_OS_SYMBIAN 1 235 # define GTEST_OS_WINDOWS 1 237 # define GTEST_OS_WINDOWS_MOBILE 1 238 # elif defined(__MINGW__) || defined(__MINGW32__) 239 # define GTEST_OS_WINDOWS_MINGW 1 241 # define GTEST_OS_WINDOWS_DESKTOP 1 242 # endif // _WIN32_WCE 243 #elif defined __APPLE__ 244 # define GTEST_OS_MAC 1 245 # if TARGET_OS_IPHONE 246 # define GTEST_OS_IOS 1 247 # if TARGET_IPHONE_SIMULATOR 248 # define GTEST_OS_IOS_SIMULATOR 1 251 #elif defined __linux__ 252 # define GTEST_OS_LINUX 1 253 # if defined __ANDROID__ 254 # define GTEST_OS_LINUX_ANDROID 1 256 #elif defined __MVS__ 257 # define GTEST_OS_ZOS 1 258 #elif defined(__sun) && defined(__SVR4) 259 # define GTEST_OS_SOLARIS 1 261 # define GTEST_OS_AIX 1 262 #elif defined(__hpux) 263 # define GTEST_OS_HPUX 1 264 #elif defined __native_client__ 265 # define GTEST_OS_NACL 1 266 #elif defined __OpenBSD__ 267 # define GTEST_OS_OPENBSD 1 268 #elif defined __QNX__ 269 # define GTEST_OS_QNX 1 272 #ifndef GTEST_LANG_CXX11 277 # if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L 279 # define GTEST_LANG_CXX11 1 281 # define GTEST_LANG_CXX11 0 288 #if !GTEST_OS_WINDOWS 294 #elif !GTEST_OS_WINDOWS_MOBILE 299 #if GTEST_OS_LINUX_ANDROID 301 # include <android/api-level.h> 305 #ifndef GTEST_HAS_POSIX_RE 306 # if GTEST_OS_LINUX_ANDROID 308 # define GTEST_HAS_POSIX_RE (__ANDROID_API__ >= 9) 310 # define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) 314 #if GTEST_HAS_POSIX_RE 322 # define GTEST_USES_POSIX_RE 1 324 #elif GTEST_OS_WINDOWS 328 # define GTEST_USES_SIMPLE_RE 1 334 # define GTEST_USES_SIMPLE_RE 1 336 #endif // GTEST_HAS_POSIX_RE 338 #ifndef GTEST_HAS_EXCEPTIONS 341 # if defined(_MSC_VER) || defined(__BORLANDC__) 345 # ifndef _HAS_EXCEPTIONS 346 # define _HAS_EXCEPTIONS 1 347 # endif // _HAS_EXCEPTIONS 348 # define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS 349 # elif defined(__GNUC__) && __EXCEPTIONS 351 # define GTEST_HAS_EXCEPTIONS 1 352 # elif defined(__SUNPRO_CC) 356 # define GTEST_HAS_EXCEPTIONS 1 357 # elif defined(__IBMCPP__) && __EXCEPTIONS 359 # define GTEST_HAS_EXCEPTIONS 1 360 # elif defined(__HP_aCC) 363 # define GTEST_HAS_EXCEPTIONS 1 367 # define GTEST_HAS_EXCEPTIONS 0 368 # endif // defined(_MSC_VER) || defined(__BORLANDC__) 369 #endif // GTEST_HAS_EXCEPTIONS 371 #if !defined(GTEST_HAS_STD_STRING) 374 # define GTEST_HAS_STD_STRING 1 375 #elif !GTEST_HAS_STD_STRING 377 # error "Google Test cannot be used where ::std::string isn't available." 378 #endif // !defined(GTEST_HAS_STD_STRING) 380 #ifndef GTEST_HAS_GLOBAL_STRING 384 # define GTEST_HAS_GLOBAL_STRING 0 386 #endif // GTEST_HAS_GLOBAL_STRING 388 #ifndef GTEST_HAS_STD_WSTRING 397 # define GTEST_HAS_STD_WSTRING \ 398 (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) 400 #endif // GTEST_HAS_STD_WSTRING 402 #ifndef GTEST_HAS_GLOBAL_WSTRING 405 # define GTEST_HAS_GLOBAL_WSTRING \ 406 (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING) 407 #endif // GTEST_HAS_GLOBAL_WSTRING 410 #ifndef GTEST_HAS_RTTI 416 # ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. 417 # define GTEST_HAS_RTTI 1 419 # define GTEST_HAS_RTTI 0 423 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) 430 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) && \ 431 !defined(__EXCEPTIONS) 432 # define GTEST_HAS_RTTI 0 434 # define GTEST_HAS_RTTI 1 435 # endif // GTEST_OS_LINUX_ANDROID && __STLPORT_MAJOR && !__EXCEPTIONS 437 # define GTEST_HAS_RTTI 0 438 # endif // __GXX_RTTI 443 # elif defined(__clang__) 445 # define GTEST_HAS_RTTI __has_feature(cxx_rtti) 449 # elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) 452 # define GTEST_HAS_RTTI 1 454 # define GTEST_HAS_RTTI 0 460 # define GTEST_HAS_RTTI 1 464 #endif // GTEST_HAS_RTTI 473 #ifndef GTEST_HAS_PTHREAD 479 # define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX \ 481 #endif // GTEST_HAS_PTHREAD 483 #if GTEST_HAS_PTHREAD 486 # include <pthread.h> 495 #ifndef GTEST_HAS_TR1_TUPLE 496 # if GTEST_OS_LINUX_ANDROID && defined(_STLPORT_MAJOR) 498 # define GTEST_HAS_TR1_TUPLE 0 501 # define GTEST_HAS_TR1_TUPLE 1 503 #endif // GTEST_HAS_TR1_TUPLE 507 #ifndef GTEST_USE_OWN_TR1_TUPLE 520 # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \ 521 && !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600 522 # define GTEST_ENV_HAS_TR1_TUPLE_ 1 528 # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) 529 # define GTEST_ENV_HAS_STD_TUPLE_ 1 532 # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_ 533 # define GTEST_USE_OWN_TR1_TUPLE 0 535 # define GTEST_USE_OWN_TR1_TUPLE 1 538 #endif // GTEST_USE_OWN_TR1_TUPLE 543 #if GTEST_HAS_TR1_TUPLE 545 # if GTEST_USE_OWN_TR1_TUPLE 546 # include "gtest/internal/gtest-tuple.h" 547 # elif GTEST_ENV_HAS_STD_TUPLE_ 560 using ::std::tuple_element;
561 using ::std::tuple_size;
565 # elif GTEST_OS_SYMBIAN 572 # ifdef BOOST_HAS_TR1_TUPLE 573 # undef BOOST_HAS_TR1_TUPLE 574 # endif // BOOST_HAS_TR1_TUPLE 578 # define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED 581 # elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) 585 # if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 591 # define _TR1_FUNCTIONAL 1 592 # include <tr1/tuple> 593 # undef _TR1_FUNCTIONAL // Allows the user to #include 596 # include <tr1/tuple> 597 # endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 603 # endif // GTEST_USE_OWN_TR1_TUPLE 605 #endif // GTEST_HAS_TR1_TUPLE 611 #ifndef GTEST_HAS_CLONE 614 # if GTEST_OS_LINUX && !defined(__ia64__) 615 # if GTEST_OS_LINUX_ANDROID 617 # if defined(__arm__) && __ANDROID_API__ >= 9 618 # define GTEST_HAS_CLONE 1 620 # define GTEST_HAS_CLONE 0 623 # define GTEST_HAS_CLONE 1 626 # define GTEST_HAS_CLONE 0 627 # endif // GTEST_OS_LINUX && !defined(__ia64__) 629 #endif // GTEST_HAS_CLONE 633 #ifndef GTEST_HAS_STREAM_REDIRECTION 636 # if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN 637 # define GTEST_HAS_STREAM_REDIRECTION 0 639 # define GTEST_HAS_STREAM_REDIRECTION 1 640 # endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN 641 #endif // GTEST_HAS_STREAM_REDIRECTION 647 #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ 648 (GTEST_OS_MAC && !GTEST_OS_IOS) || GTEST_OS_IOS_SIMULATOR || \ 649 (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ 650 GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ 651 GTEST_OS_OPENBSD || GTEST_OS_QNX) 652 # define GTEST_HAS_DEATH_TEST 1 659 #define GTEST_HAS_PARAM_TEST 1 665 #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ 666 defined(__IBMCPP__) || defined(__HP_aCC) 667 # define GTEST_HAS_TYPED_TEST 1 668 # define GTEST_HAS_TYPED_TEST_P 1 675 #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) 676 # define GTEST_HAS_COMBINE 1 680 #define GTEST_WIDE_STRING_USES_UTF16_ \ 681 (GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN || GTEST_OS_AIX) 685 # define GTEST_CAN_STREAM_RESULTS_ 1 698 #ifdef __INTEL_COMPILER 699 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ 701 # define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT 715 #if defined(__GNUC__) && !defined(COMPILER_ICC) 716 # define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) 718 # define GTEST_ATTRIBUTE_UNUSED_ 723 #define GTEST_DISALLOW_ASSIGN_(type)\ 724 void operator=(type const &) 728 #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\ 730 GTEST_DISALLOW_ASSIGN_(type) 737 #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) 738 # define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) 740 # define GTEST_MUST_USE_RESULT_ 741 #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC 746 #ifndef GTEST_HAS_SEH 749 # if defined(_MSC_VER) || defined(__BORLANDC__) 751 # define GTEST_HAS_SEH 1 754 # define GTEST_HAS_SEH 0 757 #endif // GTEST_HAS_SEH 761 # if GTEST_LINKED_AS_SHARED_LIBRARY 762 # define GTEST_API_ __declspec(dllimport) 763 # elif GTEST_CREATE_SHARED_LIBRARY 764 # define GTEST_API_ __declspec(dllexport) 775 # define GTEST_NO_INLINE_ __attribute__((noinline)) 777 # define GTEST_NO_INLINE_ 781 #if defined(__GLIBCXX__) || defined(_LIBCPP_VERSION) 782 # define GTEST_HAS_CXXABI_H_ 1 784 # define GTEST_HAS_CXXABI_H_ 0 820 #define GTEST_COMPILE_ASSERT_(expr, msg) \ 821 typedef ::testing::internal::CompileAssert<(static_cast<bool>(expr))> \ 822 msg[static_cast<bool>(expr) ? 1 : -1] GTEST_ATTRIBUTE_UNUSED_ 868 template <
typename T1,
typename T2>
869 struct StaticAssertTypeEqHelper;
871 template <
typename T>
872 struct StaticAssertTypeEqHelper<T, T> {};
874 #if GTEST_HAS_GLOBAL_STRING 878 #endif // GTEST_HAS_GLOBAL_STRING 880 #if GTEST_HAS_GLOBAL_WSTRING 882 #elif GTEST_HAS_STD_WSTRING 884 #endif // GTEST_HAS_GLOBAL_WSTRING 894 template <
typename T>
905 T *
get()
const {
return ptr_; }
909 T *
const ptr = ptr_;
918 if (
IsTrue(
sizeof(T) > 0))
947 #if GTEST_HAS_GLOBAL_STRING 951 #endif // GTEST_HAS_GLOBAL_STRING 953 RE(
const char * regex) { Init(regex); }
957 const char *
pattern()
const {
return pattern_; }
968 return FullMatch(str.c_str(), re);
972 return PartialMatch(str.c_str(), re);
975 #if GTEST_HAS_GLOBAL_STRING 979 return FullMatch(str.c_str(), re);
983 return PartialMatch(str.c_str(), re);
986 #endif // GTEST_HAS_GLOBAL_STRING 988 static bool FullMatch(
const char * str,
const RE & re);
989 static bool PartialMatch(
const char * str,
const RE & re);
992 void Init(
const char * regex);
997 const char * pattern_;
1000 #if GTEST_USES_POSIX_RE 1002 regex_t full_regex_;
1003 regex_t partial_regex_;
1005 #else // GTEST_USES_SIMPLE_RE 1007 const char * full_pattern_;
1057 #define GTEST_LOG_(severity) \ 1058 ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ 1059 __FILE__, __LINE__).GetStream() 1078 #define GTEST_CHECK_(condition) \ 1079 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ 1080 if (::testing::internal::IsTrue(condition)) \ 1083 GTEST_LOG_(FATAL) << "Condition " #condition " failed. " 1090 #define GTEST_CHECK_POSIX_SUCCESS_(posix_call) \ 1091 if (const int gtest_error = (posix_call)) \ 1092 GTEST_LOG_(FATAL) << #posix_call << "failed with error " \ 1115 template<
typename To>
1139 template<
typename To,
typename From>
1149 ::testing::internal::ImplicitCast_<From *>(to);
1154 GTEST_CHECK_(f == NULL || dynamic_cast<To>(f) != NULL);
1156 return static_cast<To
>(f);
1164 template <
class Derived,
class Base>
1169 return dynamic_cast<Derived *
>(base);
1171 return static_cast<Derived *
>(base);
1175 #if GTEST_HAS_STREAM_REDIRECTION 1188 #endif // GTEST_HAS_STREAM_REDIRECTION 1191 #if GTEST_HAS_DEATH_TEST 1193 const ::std::vector<testing::internal::string> & GetInjectableArgvs();
1194 void SetInjectableArgvs(const ::std::vector<testing::internal::string> *
1198 extern ::std::vector<testing::internal::string> g_argvs;
1200 #endif // GTEST_HAS_DEATH_TEST 1204 #if GTEST_HAS_PTHREAD 1209 inline void SleepMilliseconds(
int n)
1211 const timespec
time =
1216 nanosleep(&time, NULL);
1228 Notification() : notified_(
false)
1234 pthread_mutex_destroy(&mutex_);
1241 pthread_mutex_lock(&mutex_);
1243 pthread_mutex_unlock(&mutex_);
1248 void WaitForNotification()
1252 pthread_mutex_lock(&mutex_);
1253 const bool notified = notified_;
1254 pthread_mutex_unlock(&mutex_);
1259 SleepMilliseconds(10);
1264 pthread_mutex_t mutex_;
1275 class ThreadWithParamBase
1278 virtual ~ThreadWithParamBase() {}
1279 virtual void Run() = 0;
1288 extern "C" inline void * ThreadFuncWithCLinkage(
void * thread)
1290 static_cast<ThreadWithParamBase *
>(thread)->
Run();
1306 template <
typename T>
1307 class ThreadWithParam :
public ThreadWithParamBase
1310 typedef void (*UserThreadFunc)(T);
1313 UserThreadFunc func, T
param, Notification * thread_can_start)
1316 thread_can_start_(thread_can_start),
1319 ThreadWithParamBase *
const base =
this;
1323 pthread_create(&thread_, 0, &ThreadFuncWithCLinkage, base));
1325 ~ThreadWithParam() { Join(); }
1338 if (thread_can_start_ != NULL)
1339 { thread_can_start_->WaitForNotification(); }
1345 const UserThreadFunc func_;
1349 Notification *
const thread_can_start_;
1382 owner_ = pthread_self();
1399 void AssertHeld()
const 1401 GTEST_CHECK_(has_owner_ && pthread_equal(owner_, pthread_self()))
1402 <<
"The current thread is not holding the mutex @" <<
this;
1411 pthread_mutex_t mutex_;
1423 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ 1424 extern ::testing::internal::MutexBase mutex 1432 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ 1433 ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, false } 1437 class Mutex :
public MutexBase
1457 class GTestMutexLock
1460 explicit GTestMutexLock(MutexBase * mutex)
1461 : mutex_(mutex) { mutex_->Lock(); }
1463 ~GTestMutexLock() { mutex_->Unlock(); }
1466 MutexBase *
const mutex_;
1479 class ThreadLocalValueHolderBase
1482 virtual ~ThreadLocalValueHolderBase() {}
1487 extern "C" inline void DeleteThreadLocalValue(
void * value_holder)
1489 delete static_cast<ThreadLocalValueHolderBase *
>(value_holder);
1521 template <
typename T>
1525 ThreadLocal() : key_(CreateKey()),
1527 explicit ThreadLocal(
const T & value) : key_(CreateKey()),
1533 DeleteThreadLocalValue(pthread_getspecific(key_));
1540 T * pointer() {
return GetOrCreateValue(); }
1541 const T * pointer()
const {
return GetOrCreateValue(); }
1542 const T &
get()
const {
return *pointer(); }
1543 void set(
const T & value) { *pointer() = value; }
1547 class ValueHolder :
public ThreadLocalValueHolderBase
1550 explicit ValueHolder(
const T & value) : value_(value) {}
1552 T * pointer() {
return &value_; }
1559 static pthread_key_t CreateKey()
1565 pthread_key_create(&key, &DeleteThreadLocalValue));
1569 T * GetOrCreateValue()
const 1571 ThreadLocalValueHolderBase *
const holder =
1572 static_cast<ThreadLocalValueHolderBase *
>(pthread_getspecific(key_));
1576 return CheckedDowncastToActualType<ValueHolder>(holder)->pointer();
1579 ValueHolder *
const new_holder =
new ValueHolder(default_);
1580 ThreadLocalValueHolderBase *
const holder_base = new_holder;
1582 return new_holder->pointer();
1586 const pthread_key_t key_;
1592 # define GTEST_IS_THREADSAFE 1 1594 #else // GTEST_HAS_PTHREAD 1610 # define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ 1611 extern ::testing::internal::Mutex mutex 1613 # define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex 1615 class GTestMutexLock
1623 template <
typename T>
1631 const T &
get()
const {
return value_; }
1632 void set(
const T & value) { value_ = value; }
1639 # define GTEST_IS_THREADSAFE 0 1641 #endif // GTEST_HAS_PTHREAD 1653 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) 1656 # define GTEST_ELLIPSIS_NEEDS_POD_ 1 1658 # define GTEST_CAN_COMPARE_NULL 1 1665 #if defined(__SYMBIAN32__) || defined(__IBMCPP__) 1666 # define GTEST_NEEDS_IS_POINTER_ 1 1669 template <
bool bool_value>
1670 struct bool_constant
1673 static const bool value = bool_value;
1680 template <
typename T>
1683 template <
typename T>
1684 struct is_pointer<T *> :
public true_type {};
1686 template <
typename Iterator>
1692 template <
typename T>
1698 template <
typename T>
1704 #if GTEST_OS_WINDOWS 1705 # define GTEST_PATH_SEP_ "\\" 1706 # define GTEST_HAS_ALT_PATH_SEP_ 1 1710 # define GTEST_PATH_SEP_ "/" 1711 # define GTEST_HAS_ALT_PATH_SEP_ 0 1713 #endif // GTEST_OS_WINDOWS 1724 return isalpha(static_cast<unsigned char>(ch)) != 0;
1728 return isalnum(static_cast<unsigned char>(ch)) != 0;
1732 return isdigit(static_cast<unsigned char>(ch)) != 0;
1736 return islower(static_cast<unsigned char>(ch)) != 0;
1740 return isspace(static_cast<unsigned char>(ch)) != 0;
1744 return isupper(static_cast<unsigned char>(ch)) != 0;
1748 return isxdigit(static_cast<unsigned char>(ch)) != 0;
1752 const unsigned char low_byte =
static_cast<unsigned char>(ch);
1753 return ch == low_byte && isxdigit(low_byte) != 0;
1758 return static_cast<char>(tolower(static_cast<unsigned char>(ch)));
1762 return static_cast<char>(toupper(static_cast<unsigned char>(ch)));
1776 #if GTEST_OS_WINDOWS 1778 typedef struct _stat StatStruct;
1780 # ifdef __BORLANDC__ 1781 inline int IsATTY(
int fd) {
return isatty(fd); }
1782 inline int StrCaseCmp(
const char * s1,
const char * s2)
1784 return stricmp(s1, s2);
1786 inline char *
StrDup(
const char * src) {
return strdup(src); }
1787 # else // !__BORLANDC__ 1788 # if GTEST_OS_WINDOWS_MOBILE 1789 inline int IsATTY(
int ) {
return 0; }
1791 inline int IsATTY(
int fd) {
return _isatty(fd); }
1792 # endif // GTEST_OS_WINDOWS_MOBILE 1793 inline int StrCaseCmp(
const char * s1,
const char * s2)
1795 return _stricmp(s1, s2);
1797 inline char *
StrDup(
const char * src) {
return _strdup(src); }
1798 # endif // __BORLANDC__ 1800 # if GTEST_OS_WINDOWS_MOBILE 1801 inline int FileNo(FILE * file) {
return reinterpret_cast<int>(_fileno(file)); }
1805 inline int FileNo(FILE * file) {
return _fileno(file); }
1806 inline int Stat(
const char * path, StatStruct * buf) {
return _stat(path, buf); }
1807 inline int RmDir(
const char * dir) {
return _rmdir(dir); }
1808 inline bool IsDir(
const StatStruct & st)
1810 return (_S_IFDIR & st.st_mode) != 0;
1812 # endif // GTEST_OS_WINDOWS_MOBILE 1816 typedef struct stat StatStruct;
1818 inline int FileNo(FILE * file) {
return fileno(file); }
1819 inline int IsATTY(
int fd) {
return isatty(fd); }
1820 inline int Stat(
const char * path, StatStruct * buf) {
return stat(path, buf); }
1821 inline int StrCaseCmp(
const char * s1,
const char * s2)
1823 return strcasecmp(s1, s2);
1825 inline char *
StrDup(
const char * src) {
return strdup(src); }
1826 inline int RmDir(
const char * dir) {
return rmdir(dir); }
1827 inline bool IsDir(
const StatStruct & st) {
return S_ISDIR(st.st_mode); }
1829 #endif // GTEST_OS_WINDOWS 1835 # pragma warning(push) 1836 # pragma warning(disable:4996) 1839 inline const char *
StrNCpy(
char * dest,
const char * src,
size_t n)
1841 return strncpy(dest, src, n);
1848 #if !GTEST_OS_WINDOWS_MOBILE 1849 inline int ChDir(
const char * dir) {
return chdir(dir); }
1851 inline FILE *
FOpen(
const char * path,
const char * mode)
1853 return fopen(path, mode);
1855 #if !GTEST_OS_WINDOWS_MOBILE 1856 inline FILE *
FReopen(
const char * path,
const char * mode, FILE * stream)
1858 return freopen(path, mode, stream);
1860 inline FILE *
FDOpen(
int fd,
const char * mode) {
return fdopen(fd, mode); }
1862 inline int FClose(FILE * fp) {
return fclose(fp); }
1863 #if !GTEST_OS_WINDOWS_MOBILE 1864 inline int Read(
int fd,
void * buf,
unsigned int count)
1866 return static_cast<int>(
read(fd, buf, count));
1868 inline int Write(
int fd,
const void * buf,
unsigned int count)
1870 return static_cast<int>(
write(fd, buf, count));
1872 inline int Close(
int fd) {
return close(fd); }
1873 inline const char *
StrError(
int errnum) {
return strerror(errnum); }
1875 inline const char *
GetEnv(
const char *
name)
1877 #if GTEST_OS_WINDOWS_MOBILE 1880 #elif defined(__BORLANDC__) || defined(__SunOS_5_8) || defined(__SunOS_5_9) 1883 const char *
const env = getenv(name);
1884 return (env != NULL && env[0] !=
'\0') ? env : NULL;
1886 return getenv(name);
1891 # pragma warning(pop) // Restores the warning state. 1894 #if GTEST_OS_WINDOWS_MOBILE 1900 inline void Abort() { abort(); }
1901 #endif // GTEST_OS_WINDOWS_MOBILE 1910 #if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE 1912 # define GTEST_SNPRINTF_(buffer, size, format, ...) \ 1913 _snprintf_s(buffer, size, size, format, __VA_ARGS__) 1914 #elif defined(_MSC_VER) 1917 # define GTEST_SNPRINTF_ _snprintf 1919 # define GTEST_SNPRINTF_ snprintf 1930 ~(
static_cast<BiggestInt
>(1) << (8 *
sizeof(BiggestInt) - 1));
1950 template <
size_t size>
1977 #if GTEST_OS_WINDOWS 1978 typedef __int64
Int;
1979 typedef unsigned __int64
UInt;
1983 #endif // GTEST_OS_WINDOWS 1996 #define GTEST_FLAG(name) FLAGS_gtest_##name 1999 #define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name) 2000 #define GTEST_DECLARE_int32_(name) \ 2001 GTEST_API_ extern ::testing::internal::Int32 GTEST_FLAG(name) 2002 #define GTEST_DECLARE_string_(name) \ 2003 GTEST_API_ extern ::std::string GTEST_FLAG(name) 2006 #define GTEST_DEFINE_bool_(name, default_val, doc) \ 2007 GTEST_API_ bool GTEST_FLAG(name) = (default_val) 2008 #define GTEST_DEFINE_int32_(name, default_val, doc) \ 2009 GTEST_API_ ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) 2010 #define GTEST_DEFINE_string_(name, default_val, doc) \ 2011 GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val) 2014 #define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks) 2015 #define GTEST_LOCK_EXCLUDED_(locks) 2034 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_
TypeWithSize< 8 >::Int Int64
bool IsTrue(bool condition)
std::string GetCapturedStdout()
std::string GetCapturedStderr()
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val)
static bool FullMatch(const ::std::string &str, const RE &re)
char * StrDup(const char *src)
Iterator::value_type value_type
TypeWithSize< 4 >::Int Int32
FILE * FOpen(const char *path, const char *mode)
const T * pointer() const
Derived * CheckedDowncastToActualType(Base *base)
#define GTEST_CHECK_POSIX_SUCCESS_(posix_call)
bool BoolFromGTestEnv(const char *flag, bool default_value)
GTEST_API_::std::string FormatFileLocation(const char *file, int line)
TypeWithSize< 4 >::UInt UInt32
bool_constant< bool_value > type
bool ParseInt32(const Message &src_text, const char *str, Int32 *value)
RE(const ::std::string ®ex)
FILE * FReopen(const char *path, const char *mode, FILE *stream)
int Stat(const char *path, StatStruct *buf)
int ChDir(const char *dir)
TypeWithSize< 8 >::UInt UInt64
static bool PartialMatch(const ::std::string &str, const RE &re)
bool_constant< true > true_type
bool write(ros_opcua_srvs::Write::Request &req, ros_opcua_srvs::Write::Response &res)
const char * StringFromGTestEnv(const char *flag, const char *default_value)
int Write(int fd, const void *buf, unsigned int count)
::std::ostream & GetStream()
int RmDir(const char *dir)
int Read(int fd, void *buf, unsigned int count)
ThreadLocal(const T &value)
int StrCaseCmp(const char *s1, const char *s2)
bool read(ros_opcua_srvs::Read::Request &req, ros_opcua_srvs::Read::Response &res)
const char * StrNCpy(char *dest, const char *src, size_t n)
bool IsDir(const StatStruct &st)
#define GTEST_DISALLOW_ASSIGN_(type)
GTEST_API_::std::string FormatCompilerIndependentFileLocation(const char *file, int line)
const char * pattern() const
FILE * FDOpen(int fd, const char *mode)
const char * StrError(int errnum)
bool_constant< false > false_type
#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)
Int32 Int32FromGTestEnv(const char *flag, Int32 default_value)
#define GTEST_CHECK_(condition)
TypeWithSize< 8 >::Int TimeInMillis
const char * GetEnv(const char *name)
const BiggestInt kMaxBiggestInt