本文整理汇总了C++中testing::AllOf方法的典型用法代码示例。如果您正苦于以下问题:C++ testing::AllOf方法的具体用法?C++ testing::AllOf怎么用?C++ testing::AllOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类testing
的用法示例。
在下文中一共展示了testing::AllOf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Dyn
TEST(MergeIndexTest, Refs) {
FileIndex Dyn({"unittest"});
FileIndex StaticIndex({"unittest"});
auto MergedIndex = mergeIndex(&Dyn, &StaticIndex);
const char *HeaderCode = "class Foo;";
auto HeaderSymbols = TestTU::withHeaderCode("class Foo;").headerSymbols();
auto Foo = findSymbol(HeaderSymbols, "Foo");
// Build dynamic index for test.cc.
Annotations Test1Code(R"(class $Foo[[Foo]];)");
TestTU Test;
Test.HeaderCode = HeaderCode;
Test.Code = Test1Code.code();
Test.Filename = "test.cc";
auto AST = Test.build();
Dyn.update(Test.Filename, &AST.getASTContext(), AST.getPreprocessorPtr(),
AST.getLocalTopLevelDecls());
// Build static index for test.cc.
Test.HeaderCode = HeaderCode;
Test.Code = "// static\nclass Foo {};";
Test.Filename = "test.cc";
auto StaticAST = Test.build();
// Add stale refs for test.cc.
StaticIndex.update(Test.Filename, &StaticAST.getASTContext(),
StaticAST.getPreprocessorPtr(),
StaticAST.getLocalTopLevelDecls());
// Add refs for test2.cc
Annotations Test2Code(R"(class $Foo[[Foo]] {};)");
TestTU Test2;
Test2.HeaderCode = HeaderCode;
Test2.Code = Test2Code.code();
Test2.Filename = "test2.cc";
StaticAST = Test2.build();
StaticIndex.update(Test2.Filename, &StaticAST.getASTContext(),
StaticAST.getPreprocessorPtr(),
StaticAST.getLocalTopLevelDecls());
RefsRequest Request;
Request.IDs = {Foo.ID};
RefSlab::Builder Results;
MergedIndex->refs(Request, [&](const Ref &O) { Results.insert(Foo.ID, O); });
EXPECT_THAT(
std::move(Results).build(),
ElementsAre(Pair(
_, UnorderedElementsAre(AllOf(RefRange(Test1Code.range("Foo")),
FileURI("unittest:///test.cc")),
AllOf(RefRange(Test2Code.range("Foo")),
FileURI("unittest:///test2.cc"))))));
}