Exemplo n.º 1
0
 public void MultiContextCloneLinkTest( )
 {
     using (var context = new Context( ))
         using (var mergedMod = new BitcodeModule(context))
             using (var contextM1 = new Context( ))
                 using (var m1 = CreateSimpleModule(contextM1, "module1"))
                     using (var contextM2 = new Context( ))
                         using (var m2 = CreateSimpleModule(contextM2, "module2"))
                         {
                             Assert.AreNotSame(mergedMod.Context, m1.Context);
                             Assert.AreNotSame(mergedMod.Context, m2.Context);
                             var clone1 = m1.Clone(mergedMod.Context);
                             var clone2 = m2.Clone(mergedMod.Context);
                             GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                             mergedMod.Link(clone1);
                             GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                             Assert.IsTrue(mergedMod.Verify(out string errMsg), errMsg);
                             Assert.AreEqual(1, mergedMod.Functions.Count( ));
                             mergedMod.Link(clone2);
                             GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true);
                             Assert.IsTrue(mergedMod.Verify(out errMsg), errMsg);
                             Assert.AreEqual(2, mergedMod.Functions.Count( ));
                         }
 }