#include "llvm/FileCheck/FileCheck.h"
#include "../lib/FileCheck/FileCheckImpl.h"
#include "llvm/Support/Regex.h"
#include "llvm/Testing/Support/Error.h"
#include "gtest/gtest.h"
#include <tuple>
#include <unordered_set>
usingnamespacellvm;
namespace {
class FileCheckTest : public ::testing::Test { … };
static StringRef bufferize(SourceMgr &SM, StringRef Str) { … }
static std::string toString(const std::unordered_set<std::string> &Set) { … }
template <typename ErrorT>
static void expectSameErrors(std::unordered_set<std::string> ExpectedMsgs,
Error Err) { … }
template <typename ErrorT>
static void expectError(StringRef ExpectedMsg, Error Err) { … }
static void expectDiagnosticError(StringRef ExpectedMsg, Error Err) { … }
constexpr uint64_t MaxUint64 = …;
constexpr int64_t MaxInt64 = …;
constexpr int64_t MinInt64 = …;
constexpr uint64_t AbsoluteMinInt64 = …;
constexpr uint64_t AbsoluteMaxInt64 = …;
constexpr unsigned LiteralsBitWidth = …;
struct ExpressionFormatParameterisedFixture
: public ::testing::TestWithParam<
std::tuple<ExpressionFormat::Kind, unsigned, bool>> { … };
TEST_P(ExpressionFormatParameterisedFixture, FormatGetWildcardRegex) { … }
TEST_P(ExpressionFormatParameterisedFixture, FormatGetMatchingString) { … }
TEST_P(ExpressionFormatParameterisedFixture, FormatValueFromStringRepr) { … }
TEST_P(ExpressionFormatParameterisedFixture, FormatBoolOperator) { … }
INSTANTIATE_TEST_SUITE_P(…);
TEST_F(FileCheckTest, NoFormatProperties) { … }
TEST_F(FileCheckTest, FormatEqualityOperators) { … }
TEST_F(FileCheckTest, FormatKindEqualityOperators) { … }
static void expectOperationValueResult(binop_eval_t Operation, APInt LeftValue,
APInt RightValue, APInt ExpectedValue) { … }
template <class T1, class T2, class TR>
static void expectOperationValueResult(binop_eval_t Operation, T1 LeftValue,
T2 RightValue, TR ResultValue) { … }
template <class T1, class T2>
static void expectOperationValueResult(binop_eval_t Operation, T1 LeftValue,
T2 RightValue) { … }
TEST_F(FileCheckTest, ExpressionValueAddition) { … }
TEST_F(FileCheckTest, ExpressionValueSubtraction) { … }
TEST_F(FileCheckTest, ExpressionValueMultiplication) { … }
TEST_F(FileCheckTest, ExpressionValueDivision) { … }
TEST_F(FileCheckTest, Literal) { … }
TEST_F(FileCheckTest, Expression) { … }
static void
expectUndefErrors(std::unordered_set<std::string> ExpectedUndefVarNames,
Error Err) { … }
TEST_F(FileCheckTest, NumericVariable) { … }
TEST_F(FileCheckTest, Binop) { … }
TEST_F(FileCheckTest, ValidVarNameStart) { … }
TEST_F(FileCheckTest, ParseVar) { … }
static void expectNotFoundError(Error Err) { … }
class PatternTester { … };
TEST_F(FileCheckTest, ParseNumericSubstitutionBlock) { … }
TEST_F(FileCheckTest, ParsePattern) { … }
TEST_F(FileCheckTest, Match) { … }
TEST_F(FileCheckTest, MatchParen) { … }
TEST_F(FileCheckTest, MatchBuiltinFunctions) { … }
TEST_F(FileCheckTest, Substitution) { … }
TEST_F(FileCheckTest, FileCheckContext) { … }
TEST_F(FileCheckTest, CapturedVarDiags) { … }
}