5 #ifndef STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ 6 #define STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ 33 extern std::string
TmpDir();
47 std::stringstream
ss_;
63 ss_ <<
" Assertion failure " << msg;
77 #define BINARY_OP(name,op) \ 78 template <class X, class Y> \ 79 Tester& name(const X& x, const Y& y) { \ 81 ss_ << " failed: " << x << (" " #op " ") << y; \ 105 #define ASSERT_TRUE(c) ::leveldb::test::Tester(__FILE__, __LINE__).Is((c), #c) 106 #define ASSERT_OK(s) ::leveldb::test::Tester(__FILE__, __LINE__).IsOk((s)) 107 #define ASSERT_EQ(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsEq((a),(b)) 108 #define ASSERT_NE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsNe((a),(b)) 109 #define ASSERT_GE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsGe((a),(b)) 110 #define ASSERT_GT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsGt((a),(b)) 111 #define ASSERT_LE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLe((a),(b)) 112 #define ASSERT_LT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLt((a),(b)) 114 #define TCONCAT(a,b) TCONCAT1(a,b) 115 #define TCONCAT1(a,b) a##b 117 #define TEST(base,name) \ 118 class TCONCAT(_Test_,name) : public base { \ 121 static void _RunIt() { \ 122 TCONCAT(_Test_,name) t; \ 126 bool TCONCAT(_Test_ignored_,name) = \ 127 ::leveldb::test::RegisterTest(#base, #name, &TCONCAT(_Test_,name)::_RunIt); \ 128 void TCONCAT(_Test_,name)::_Run() 132 extern bool RegisterTest(
const char* base,
const char*
name,
void (*func)());
138 #endif // STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ bool ok_
Definition: testharness.h:44
Definition: autocompact_test.cc:11
bool RegisterTest(const char *base, const char *name, void(*func)())
Definition: testharness.cc:24
std::string TmpDir()
Definition: testharness.cc:60
int RandomSeed()
Definition: testharness.cc:67
const char * fname_
Definition: testharness.h:45
int RunAllTests()
Definition: testharness.cc:36
Tester(const char *f, int l)
Definition: testharness.h:50
std::stringstream ss_
Definition: testharness.h:47
stderr
Definition: optimize-pngs.py:47
f
Definition: linearize-data.py:263
std::string ToString() const
Definition: status.cc:36
Tester & operator<<(const V &value)
Definition: testharness.h:97
const char * name
Definition: rest.cpp:39
Tester & IsOk(const Status &s)
Definition: testharness.h:69
Definition: testharness.h:42
Tester & Is(bool b, const char *msg)
Definition: testharness.h:61
#define BINARY_OP(name, op)
Definition: testharness.h:77
bool ok() const
Definition: status.h:52
~Tester()
Definition: testharness.h:54
int line_
Definition: testharness.h:46