MCPcopy Create free account
hub / github.com/NVIDIA/cuda-quantum / TEST

Function TEST

unittests/Optimizer/FactoryMergeModuleTest.cpp:26–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24}
25
26TEST(FactoryMergeModuleTest, CopiesMissingFunction) {
27 DialectRegistry registry;
28 registry.insert<mlir::func::FuncDialect, mlir::LLVM::LLVMDialect>();
29 MLIRContext ctx(registry);
30
31 auto dst = parse(ctx, R"mlir(
32 module {
33 func.func @alreadyThere() { return }
34 }
35 )mlir");
36 ASSERT_TRUE(dst);
37
38 auto src = parse(ctx, R"mlir(
39 module {
40 func.func @newFunc() { return }
41 func.func @alreadyThere() { return }
42 }
43 )mlir");
44 ASSERT_TRUE(src);
45
46 mergeModules(*dst, *src);
47
48 auto newFunc = dst->lookupSymbol<mlir::func::FuncOp>("newFunc");
49 EXPECT_TRUE(newFunc);
50
51 int countAlreadyThere = 0;
52 dst->walk([&](mlir::func::FuncOp f) {
53 if (f.getSymName() == "alreadyThere")
54 countAlreadyThere++;
55 });
56 EXPECT_EQ(countAlreadyThere, 1);
57}
58
59TEST(FactoryMergeModuleTest, RetainOriginalModuleSymbols) {
60 DialectRegistry registry;

Callers

nothing calls this directly

Calls 3

walkMethod · 0.80
parseFunction · 0.70
getValueMethod · 0.45

Tested by

no test coverage detected