コード例 #1
0
        public void TestUniqueNamesAcrossTranslationUnits()
        {
            passBuilder.AddPass(new CleanInvalidDeclNamesPass());
            passBuilder.RunPasses(pass => pass.VisitASTContext(AstContext));

            var unnamedEnum1 = AstContext.GetEnumWithMatchingItem("UnnamedEnumA1");
            var unnamedEnum2 = AstContext.GetEnumWithMatchingItem("UnnamedEnumB1");

            Assert.IsNotNull(unnamedEnum1);
            Assert.IsNotNull(unnamedEnum2);

            Assert.AreNotEqual(unnamedEnum1.Name, unnamedEnum2.Name);
        }
コード例 #2
0
 public void TestRemovalOfUnusedStdTypes()
 {
     new IgnoreSystemDeclarationsPass {
         Context = Driver.Context
     }.VisitASTContext(AstContext);
     if (Platform.IsWindows)
     {
         Assert.That(AstContext.GetEnumWithMatchingItem("_ALLOC_MASK").Ignore, Is.True);
         Assert.That(AstContext.FindClass("_Ctypevec").First().Ignore, Is.True);
         return;
     }
     if (Platform.IsLinux)
     {
         Assert.That(AstContext.GetEnumWithMatchingItem("PTHREAD_RWLOCK_PREFER_READER_NP").Ignore, Is.True);
         Assert.That(AstContext.FindClass("pthread_mutex_t").First().Ignore, Is.True);
         return;
     }
     if (Platform.IsMacOS)
     {
         Assert.That(AstContext.GetEnumWithMatchingItem("__n_words").Ignore, Is.True);
         Assert.That(AstContext.FindClass("__darwin_fp_control").First().Ignore, Is.True);
         return;
     }
 }