webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Namespaces | Macros | Typedefs | Functions
util.h File Reference
#include "config.h"
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <errno.h>

Go to the source code of this file.

Classes

struct  GFLAGS_NAMESPACE::CompileAssert< b >
 
struct  GFLAGS_NAMESPACE::CompileAssert< true >
 
class  GFLAGS_NAMESPACE::testing::Test
 

Namespaces

 GFLAGS_NAMESPACE
 
 GFLAGS_NAMESPACE::testing
 

Macros

#define strto64   strtol
 
#define strtou64   strtoul
 
#define PRId32   "d"
 
#define PRId64   "lld"
 
#define PRIu64   "llu"
 
#define COMPILE_ASSERT(expr, msg)   enum { assert_##msg = sizeof(CompileAssert<bool(expr)>) }
 
#define arraysize(arr)   (sizeof(arr)/sizeof(*(arr)))
 
#define LOG(level)   std::cerr
 
#define VLOG(level)   if (true) {} else std::cerr
 
#define DVLOG(level)   if (true) {} else std::cerr
 
#define EXPECT_TRUE(condition)
 
#define EXPECT_OP(op, val1, val2)
 
#define EXPECT_EQ(val1, val2)   EXPECT_OP(==, val1, val2)
 
#define EXPECT_NE(val1, val2)   EXPECT_OP(!=, val1, val2)
 
#define EXPECT_LE(val1, val2)   EXPECT_OP(<=, val1, val2)
 
#define EXPECT_LT(val1, val2)   EXPECT_OP(< , val1, val2)
 
#define EXPECT_GE(val1, val2)   EXPECT_OP(>=, val1, val2)
 
#define EXPECT_GT(val1, val2)   EXPECT_OP(> , val1, val2)
 
#define EXPECT_FALSE(cond)   EXPECT_TRUE(!(cond))
 
#define EXPECT_NAN(arg)
 
#define EXPECT_INF(arg)
 
#define EXPECT_DOUBLE_EQ(val1, val2)
 
#define EXPECT_STREQ(val1, val2)
 
#define TEST_INIT
 
#define TEST(a, b)
 
#define EXPECT_DEATH_INIT
 
#define EXPECT_DEATH(fn, msg)
 
#define GTEST_HAS_DEATH_TEST   1
 

Typedefs

typedef signed char GFLAGS_NAMESPACE::int8
 
typedef unsigned char GFLAGS_NAMESPACE::uint8
 

Functions

void GFLAGS_NAMESPACE::MakeTmpdir (std::string *path)
 
void GFLAGS_NAMESPACE::InternalStringPrintf (std::string *output, const char *format, va_list ap)
 
void GFLAGS_NAMESPACE::SStringPrintf (std::string *output, const char *format,...)
 
void GFLAGS_NAMESPACE::StringAppendF (std::string *output, const char *format,...)
 
std::string GFLAGS_NAMESPACE::StringPrintf (const char *format,...)
 
bool GFLAGS_NAMESPACE::SafeGetEnv (const char *varname, std::string &valstr)
 
int GFLAGS_NAMESPACE::SafeFOpen (FILE **fp, const char *fname, const char *mode)
 

Macro Definition Documentation

◆ arraysize

#define arraysize (   arr)    (sizeof(arr)/sizeof(*(arr)))

◆ COMPILE_ASSERT

#define COMPILE_ASSERT (   expr,
  msg 
)    enum { assert_##msg = sizeof(CompileAssert<bool(expr)>) }

◆ DVLOG

#define DVLOG (   level)    if (true) {} else std::cerr

◆ EXPECT_DEATH

#define EXPECT_DEATH (   fn,
  msg 
)
Value:
do { \
g_called_exit = false; \
gflags_exitfunc = &CalledExit; \
fn; \
gflags_exitfunc = &exit; /* set back to its default */ \
if (!g_called_exit) { \
fprintf(stderr, "Function didn't die (%s): %s\n", msg, #fn); \
exit(1); \
} \
} while (0)
exit
Definition: wrong-credential-1-redirect-to-auth.php:5
stderr
Definition: barcode_decoder.py:21
fn
Definition: generate-asm-lcov.py:146

◆ EXPECT_DEATH_INIT

#define EXPECT_DEATH_INIT
Value:
static bool g_called_exit; \
static void CalledExit(int) { g_called_exit = true; }

◆ EXPECT_DOUBLE_EQ

#define EXPECT_DOUBLE_EQ (   val1,
  val2 
)
Value:
do { \
if (((val1) < (val2) - 0.001 || (val1) > (val2) + 0.001)) { \
fprintf(stderr, "Check failed: %s == %s\n", #val1, #val2); \
exit(1); \
} \
} while (0)
stderr
Definition: barcode_decoder.py:21

◆ EXPECT_EQ

#define EXPECT_EQ (   val1,
  val2 
)    EXPECT_OP(==, val1, val2)

◆ EXPECT_FALSE

#define EXPECT_FALSE (   cond)    EXPECT_TRUE(!(cond))

◆ EXPECT_GE

#define EXPECT_GE (   val1,
  val2 
)    EXPECT_OP(>=, val1, val2)

◆ EXPECT_GT

#define EXPECT_GT (   val1,
  val2 
)    EXPECT_OP(> , val1, val2)

◆ EXPECT_INF

#define EXPECT_INF (   arg)

◆ EXPECT_LE

#define EXPECT_LE (   val1,
  val2 
)    EXPECT_OP(<=, val1, val2)

◆ EXPECT_LT

#define EXPECT_LT (   val1,
  val2 
)    EXPECT_OP(< , val1, val2)

◆ EXPECT_NAN

#define EXPECT_NAN (   arg)

◆ EXPECT_NE

#define EXPECT_NE (   val1,
  val2 
)    EXPECT_OP(!=, val1, val2)

◆ EXPECT_OP

#define EXPECT_OP (   op,
  val1,
  val2 
)
Value:
if (true) { \
if (!((val1) op (val2))) { \
fprintf(stderr, "Check failed: %s %s %s\n", #val1, #op, #val2); \
exit(1); \
} \
} else std::cerr << ""
stderr
Definition: barcode_decoder.py:21

◆ EXPECT_STREQ

#define EXPECT_STREQ (   val1,
  val2 
)
Value:
do { \
if (strcmp((val1), (val2)) != 0) { \
fprintf(stderr, "Check failed: streq(%s, %s)\n", #val1, #val2); \
exit(1); \
} \
} while (0)
stderr
Definition: barcode_decoder.py:21

◆ EXPECT_TRUE

#define EXPECT_TRUE (   condition)
Value:
if (true) { \
if (!(condition)) { \
fprintf(stderr, "Check failed: %s\n", #condition); \
exit(1); \
} \
} else std::cerr << ""
GLenum condition
Definition: gl2ext.h:2537
stderr
Definition: barcode_decoder.py:21

◆ GTEST_HAS_DEATH_TEST

#define GTEST_HAS_DEATH_TEST   1

◆ LOG

#define LOG (   level)    std::cerr

◆ PRId32

#define PRId32   "d"

◆ PRId64

#define PRId64   "lld"

◆ PRIu64

#define PRIu64   "llu"

◆ strto64

#define strto64   strtol

◆ strtou64

#define strtou64   strtoul

◆ TEST

#define TEST (   a,
  b 
)
Value:
struct Test_##a##_##b { \
Test_##a##_##b() { g_testlist.push_back(&Run); } \
static void Run() { \
FlagSaver fs; \
fprintf(stderr, "Running test %s/%s\n", #a, #b); \
RunTest(); \
} \
static void RunTest(); \
}; \
static Test_##a##_##b g_test_##a##_##b; \
void Test_##a##_##b::RunTest()
def Run(command)
Definition: gtest_break_on_failure_unittest.py:86
s fs(1)
stderr
Definition: barcode_decoder.py:21
GLboolean GLboolean GLboolean GLboolean a
Definition: gl2ext.h:306
GLboolean GLboolean GLboolean b
Definition: gl2ext.h:306
void RunTest(std::string out_path)
Definition: voe_cmd_test.cc:204

◆ TEST_INIT

#define TEST_INIT
Value:
static std::vector<void (*)()> g_testlist; /* the tests to run */ \
static int RUN_ALL_TESTS() { \
std::vector<void (*)()>::const_iterator it; \
for (it = g_testlist.begin(); it != g_testlist.end(); ++it) { \
(*it)(); /* The test will error-exit if there's a problem. */ \
} \
fprintf(stderr, "\nPassed %d tests\n\nPASS\n", \
static_cast<int>(g_testlist.size())); \
return 0; \
}
stderr
Definition: barcode_decoder.py:21
#define RUN_ALL_TESTS()
Definition: gtest.h:2047

◆ VLOG

#define VLOG (   level)    if (true) {} else std::cerr