grpc
third_party
bloaty
third_party
re2
util
bloaty/third_party/re2/util/test.h
Go to the documentation of this file.
1
// Copyright 2009 The RE2 Authors. All Rights Reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
5
#ifndef UTIL_TEST_H_
6
#define UTIL_TEST_H_
7
8
#include "util/util.h"
9
#include "util/flags.h"
10
#include "util/logging.h"
11
12
#define TEST(x, y) \
13
void x##y(void); \
14
TestRegisterer r##x##y(x##y, # x "." # y); \
15
void x##y(void)
16
17
void
RegisterTest
(
void
(*)(
void
),
const
char
*);
18
19
class
TestRegisterer
{
20
public
:
21
TestRegisterer
(
void
(*
fn
)(
void
),
const
char
*s) {
22
RegisterTest
(
fn
, s);
23
}
24
};
25
26
// fatal assertions
27
#define ASSERT_TRUE CHECK
28
#define ASSERT_FALSE(x) CHECK(!(x))
29
#define ASSERT_EQ CHECK_EQ
30
#define ASSERT_NE CHECK_NE
31
#define ASSERT_LT CHECK_LT
32
#define ASSERT_LE CHECK_LE
33
#define ASSERT_GT CHECK_GT
34
#define ASSERT_GE CHECK_GE
35
36
// nonfatal assertions
37
// TODO(rsc): Do a better job?
38
#define EXPECT_TRUE CHECK
39
#define EXPECT_FALSE(x) CHECK(!(x))
40
#define EXPECT_EQ CHECK_EQ
41
#define EXPECT_NE CHECK_NE
42
#define EXPECT_LT CHECK_LT
43
#define EXPECT_LE CHECK_LE
44
#define EXPECT_GT CHECK_GT
45
#define EXPECT_GE CHECK_GE
46
47
namespace
testing
{
48
class
MallocCounter
{
49
public
:
50
MallocCounter
(
int
x) {}
51
static
const
int
THIS_THREAD_ONLY
= 0;
52
long
long
HeapGrowth
() {
return
0; }
53
long
long
PeakHeapGrowth
() {
return
0; }
54
void
Reset
() {}
55
};
56
}
// namespace testing
57
58
#endif // UTIL_TEST_H_
testing
Definition:
aws_request_signer_test.cc:25
testing::MallocCounter::MallocCounter
MallocCounter(int x)
Definition:
bloaty/third_party/re2/util/test.h:50
TestRegisterer
Definition:
bloaty/third_party/re2/util/test.h:19
testing::MallocCounter::PeakHeapGrowth
long long PeakHeapGrowth()
Definition:
bloaty/third_party/re2/util/test.h:53
generate-asm-lcov.fn
fn
Definition:
generate-asm-lcov.py:146
RegisterTest
void RegisterTest(void(*)(void), const char *)
Definition:
third_party/bloaty/third_party/re2/util/test.cc:19
TestRegisterer::TestRegisterer
TestRegisterer(void(*fn)(void), const char *s)
Definition:
bloaty/third_party/re2/util/test.h:21
testing::MallocCounter::Reset
void Reset()
Definition:
bloaty/third_party/re2/util/test.h:54
testing::MallocCounter
Definition:
bloaty/third_party/re2/util/test.h:48
testing::MallocCounter::HeapGrowth
long long HeapGrowth()
Definition:
bloaty/third_party/re2/util/test.h:52
testing::MallocCounter::THIS_THREAD_ONLY
static const int THIS_THREAD_ONLY
Definition:
bloaty/third_party/re2/util/test.h:51
grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:27