blob: 4ca74c487b3ee72f03c431681c9fb2d46624e601 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
//===- ErrorChecking.h - Helpers for verifying llvm::Errors -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H
#define LLVM_UNITTESTS_DEBUGINFO_CODEVIEW_ERRORCHECKING_H
#define EXPECT_NO_ERROR(Err) \
{ \
auto E = Err; \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) \
consumeError(std::move(E)); \
}
#define EXPECT_ERROR(Err) \
{ \
auto E = Err; \
EXPECT_TRUE(static_cast<bool>(E)); \
if (E) \
consumeError(std::move(E)); \
}
#define ASSERT_EXPECTED(Exp) \
{ \
auto E = Exp.takeError(); \
bool Success = static_cast<bool>(E); \
if (!Success) \
consumeError(std::move(E)); \
ASSERT_FALSE(Success); \
}
#define EXPECT_EXPECTED(Exp) \
{ \
auto E = Exp.takeError(); \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
}
#define EXPECT_EXPECTED_EQ(Val, Exp) \
{ \
auto Result = Exp; \
auto E = Result.takeError(); \
EXPECT_FALSE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
EXPECT_EQ(Val, *Result); \
}
#define EXPECT_UNEXPECTED(Exp) \
{ \
auto E = Exp.takeError(); \
EXPECT_TRUE(static_cast<bool>(E)); \
if (E) { \
consumeError(std::move(E)); \
return; \
} \
}
#endif
|