public void TestInterfaceHeaderNotConfigured() { IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\InterfaceHeaders\includeinterfaceheader.cpp"), "", 0); checker.CheckIncludes(); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(1, results.Count); }
public void TestUsedHeaders() { IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UsedHeaders\sourcefile.cpp"), "", 0); checker.CheckIncludes(); Assert.AreEqual(0, checker.NrWarnings); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(0, results.Count); }
public void TestIgnorePathOnNonExistentHeaderAndSource() { mConfig.AddIgnoreHeaderInfo(new IncludeChecker.IgnoreHeaderInfo("sourcefile.cpp", "unknown.h")); IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\IgnoreNonExistentHeader\sourcefile.cpp"), "", 0); checker.CheckIncludes(); Assert.AreEqual(0, checker.NrWarnings); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(0, results.Count); }
public void TestTypeAliasSuffix() { mConfig.AddTypeAliasPrefix("a"); mConfig.AddTypeAliasSuffix("Ref"); IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\TypeAliasSuffix\sourcefile.cpp"), "", 0); checker.CheckIncludes(); Assert.AreEqual(0, checker.NrWarnings); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(0, results.Count); }
public void TestIgnorePathOnHeader() { mConfig.AddIgnorePath(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\IgnoreUnusedHeaders\unused.h")); mConfig.AddIgnorePath(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\IgnoreUnusedHeaders\unused2.h")); mConfig.AddIgnorePath(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\IgnoreUnusedHeaders\unused3.h")); IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\IgnoreUnusedHeaders\sourcefile.cpp"), "", 0); checker.CheckIncludes(); Assert.AreEqual(0, checker.NrWarnings); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(0, results.Count); }
/// <summary> /// Run the check with all command line arguments. /// </summary> public bool Check(string[] inCommandLine) { ParseCommandLine(inCommandLine); IncludeChecker checker = new IncludeChecker(this, mConfig, mStartFiles, mStartDir, mNrWarnings); checker.CheckIncludes(); if (!string.IsNullOrEmpty(mXmlOutputPath)) { List <IncludeChecker.UnusedHeaderResult> results = checker.Results; WriteResultsToXml(results, mXmlOutputPath); } return(checker.Results.Count == 0); }
public void TestUnusedHeaderAfterHeaderWithoutTags() { IncludeChecker checker = new IncludeChecker(new TestOutput(), mConfig, TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UnusedHeaders\sourcefile2.cpp"), "", 0); checker.CheckIncludes(); Assert.AreEqual(0, checker.NrWarnings); List <IncludeChecker.UnusedHeaderResult> results = checker.Results; Assert.AreEqual(2, results.Count); Assert.AreEqual(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UnusedHeaders\sourcefile2.cpp"), results[0].SourceFile); Assert.AreEqual(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UnusedHeaders\onlyincludes.h"), results[0].HeaderFile); Assert.AreEqual(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UnusedHeaders\sourcefile2.cpp"), results[1].SourceFile); Assert.AreEqual(TestUtils.sGetFullPath(@"IncludeCheckerLib\test\UnusedHeaders\header.h"), results[1].HeaderFile); }