Fix includes in util/testharness.h.
This CL removes unused headers included by util/testharness.h, adds precise includes where the build breaks, and fixes style errors in the edited files. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=189331061
This commit is contained in:
parent
aece2068d7
commit
8143c12f3f
@ -5,11 +5,10 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "db/db_impl.h"
|
|
||||||
#include "db/version_set.h"
|
|
||||||
#include "leveldb/cache.h"
|
#include "leveldb/cache.h"
|
||||||
#include "leveldb/db.h"
|
#include "leveldb/db.h"
|
||||||
#include "leveldb/env.h"
|
#include "leveldb/env.h"
|
||||||
|
#include "leveldb/filter_policy.h"
|
||||||
#include "leveldb/write_batch.h"
|
#include "leveldb/write_batch.h"
|
||||||
#include "port/port.h"
|
#include "port/port.h"
|
||||||
#include "util/crc32c.h"
|
#include "util/crc32c.h"
|
||||||
|
@ -12,7 +12,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "leveldb/slice.h"
|
#include "leveldb/slice.h"
|
||||||
#include "port/port.h"
|
#include "port/port.h"
|
||||||
|
|
||||||
@ -35,8 +37,8 @@ bool GetLengthPrefixedSlice(Slice* input, Slice* result);
|
|||||||
// in *v and return a pointer just past the parsed value, or return
|
// in *v and return a pointer just past the parsed value, or return
|
||||||
// NULL on error. These routines only look at bytes in the range
|
// NULL on error. These routines only look at bytes in the range
|
||||||
// [p..limit-1]
|
// [p..limit-1]
|
||||||
const char* GetVarint32Ptr(const char* p,const char* limit, uint32_t* v);
|
const char* GetVarint32Ptr(const char* p, const char* limit, uint32_t* v);
|
||||||
const char* GetVarint64Ptr(const char* p,const char* limit, uint64_t* v);
|
const char* GetVarint64Ptr(const char* p, const char* limit, uint64_t* v);
|
||||||
|
|
||||||
// Returns the length of the varint32 or varint64 encoding of "v"
|
// Returns the length of the varint32 or varint64 encoding of "v"
|
||||||
int VarintLength(uint64_t v);
|
int VarintLength(uint64_t v);
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
// found in the LICENSE file. See the AUTHORS file for names of contributors.
|
||||||
|
|
||||||
#include "util/coding.h"
|
#include <vector>
|
||||||
|
|
||||||
|
#include "util/coding.h"
|
||||||
#include "util/testharness.h"
|
#include "util/testharness.h"
|
||||||
|
|
||||||
namespace leveldb {
|
namespace leveldb {
|
||||||
|
@ -4,11 +4,15 @@
|
|||||||
|
|
||||||
#include "util/testharness.h"
|
#include "util/testharness.h"
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "leveldb/env.h"
|
||||||
|
|
||||||
namespace leveldb {
|
namespace leveldb {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "leveldb/env.h"
|
|
||||||
#include "leveldb/slice.h"
|
#include "leveldb/status.h"
|
||||||
#include "util/random.h"
|
|
||||||
|
|
||||||
namespace leveldb {
|
namespace leveldb {
|
||||||
namespace test {
|
namespace test {
|
||||||
@ -74,10 +74,10 @@ class Tester {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BINARY_OP(name,op) \
|
#define BINARY_OP(name, op) \
|
||||||
template <class X, class Y> \
|
template <class X, class Y> \
|
||||||
Tester& name(const X& x, const Y& y) { \
|
Tester& name(const X& x, const Y& y) { \
|
||||||
if (! (x op y)) { \
|
if (!(x op y)) { \
|
||||||
ss_ << " failed: " << x << (" " #op " ") << y; \
|
ss_ << " failed: " << x << (" " #op " ") << y; \
|
||||||
ok_ = false; \
|
ok_ = false; \
|
||||||
} \
|
} \
|
||||||
@ -111,21 +111,21 @@ class Tester {
|
|||||||
#define ASSERT_LE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLe((a),(b))
|
#define ASSERT_LE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLe((a),(b))
|
||||||
#define ASSERT_LT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLt((a),(b))
|
#define ASSERT_LT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLt((a),(b))
|
||||||
|
|
||||||
#define TCONCAT(a,b) TCONCAT1(a,b)
|
#define TCONCAT(a, b) TCONCAT1(a, b)
|
||||||
#define TCONCAT1(a,b) a##b
|
#define TCONCAT1(a, b) a##b
|
||||||
|
|
||||||
#define TEST(base,name) \
|
#define TEST(base, name) \
|
||||||
class TCONCAT(_Test_,name) : public base { \
|
class TCONCAT(_Test_, name) : public base { \
|
||||||
public: \
|
public: \
|
||||||
void _Run(); \
|
void _Run(); \
|
||||||
static void _RunIt() { \
|
static void _RunIt() { \
|
||||||
TCONCAT(_Test_,name) t; \
|
TCONCAT(_Test_, name) t; \
|
||||||
t._Run(); \
|
t._Run(); \
|
||||||
} \
|
} \
|
||||||
}; \
|
}; \
|
||||||
bool TCONCAT(_Test_ignored_,name) = \
|
bool TCONCAT(_Test_ignored_, name) = \
|
||||||
::leveldb::test::RegisterTest(#base, #name, &TCONCAT(_Test_,name)::_RunIt); \
|
::leveldb::test::RegisterTest(#base, #name, &TCONCAT(_Test_, name)::_RunIt); \
|
||||||
void TCONCAT(_Test_,name)::_Run()
|
void TCONCAT(_Test_, name)::_Run()
|
||||||
|
|
||||||
// Register the specified test. Typically not used directly, but
|
// Register the specified test. Typically not used directly, but
|
||||||
// invoked via the macro expansion of TEST.
|
// invoked via the macro expansion of TEST.
|
||||||
|
Loading…
Reference in New Issue
Block a user