コード例 #1
0
        public void TrendLogTest()
        {
            AnalyzerCollector collector = IntegrationTests.Analyze("log.cs");

            Assert.AreEqual(1, collector.Collection.Count);
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Log::Write", collector.Collection));
            Assert.AreEqual(1, IntegrationTests.GetComplexityFromCollection("Log::Write", collector.Collection));

            Assert.AreEqual(15, collector.Metrics["Log::Write(string text)"].StartLineNumber);
            Assert.AreEqual(17, collector.Metrics["Log::Write(string text)"].EndLineNumber);
        }
コード例 #2
0
        public void ValianTest()
        {
            AnalyzerCollector collector = IntegrationTests.Analyze("valian.c");

            Assert.AreEqual(3, collector.Collection.Count);
            Assert.IsTrue(IntegrationTests.FunctionIsInCollection("SmpEditFrameProc", collector.Collection));
            Assert.IsTrue(IntegrationTests.FunctionIsInCollection("InstrumentWndProc", collector.Collection));
            Assert.IsTrue(IntegrationTests.FunctionIsInCollection("InstrumentWndProc2", collector.Collection));

            Assert.AreEqual(3, IntegrationTests.GetComplexityFromCollection("InstrumentWndProc", collector.Collection));
            Assert.AreEqual(5, IntegrationTests.GetComplexityFromCollection("InstrumentWndProc2", collector.Collection));
            Assert.AreEqual(22, IntegrationTests.GetComplexityFromCollection("SmpEditFrameProc", collector.Collection));
        }
コード例 #3
0
        public void CxxMocksTests()
        {
            AnalyzerCollector collector = IntegrationTests.Analyze("CxxMocks.h");

            Assert.AreEqual(9, collector.Collection.Count);

            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock0::AndReturn", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock0<void>::Func", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock1::Expect", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock1::AndReturn", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock1::Func", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock1<void,_Arg1>::Expect", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("Mock1<void,_Arg1>::Func", collector.Collection));
        }
コード例 #4
0
        public void ReportedCppErrors()
        {
            AnalyzerCollector collector = IntegrationTests.Analyze("ReportedCppErrors.cpp");

            Assert.AreEqual(4, collector.Collection.Count);
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("DllMain", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("test::testing", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("GetXMLStuff", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("AssertWinFile", collector.Collection));

            Assert.AreEqual(6, IntegrationTests.GetComplexityFromCollection("DllMain", collector.Collection));
            Assert.AreEqual(4, IntegrationTests.GetComplexityFromCollection("test::testing", collector.Collection));
            Assert.AreEqual(1, IntegrationTests.GetComplexityFromCollection("GetXMLStuff", collector.Collection));
            Assert.AreEqual(2, IntegrationTests.GetComplexityFromCollection("AssertWinFile", collector.Collection));
        }
コード例 #5
0
        public void TestSuppressMethodSignature()
        {
            {
                AnalyzerCollector collector = IntegrationTests.Analyze("valian.c");

                Assert.AreEqual(3, collector.Collection["InstrumentWndProc(WPARAM wParam)"]);
                Assert.AreEqual(5, collector.Collection["InstrumentWndProc2(WPARAM wParam)"]);
            }
            {
                AnalyzerCollector collector = IntegrationTests.Analyze("valian.c", true);

                Assert.AreEqual(3, collector.Collection["InstrumentWndProc"]);
                Assert.AreEqual(5, collector.Collection["InstrumentWndProc2"]);
            }
        }
コード例 #6
0
        private static AnalyzerCollector Analyze(string filename, bool suppressMethodSignature)
        {
            //TODO: start using SortedListener instead of AnalyzerCollector (remove this one)
            AnalyzerCollector collector = new AnalyzerCollector();

            StreamReader stream = new StreamReader(filename);

            try
            {
                FileAnalyzer analyzer =
                    new FileAnalyzer(stream, collector, null, suppressMethodSignature, filename);

                analyzer.Analyze();
            }
            finally
            {
                stream.Dispose();
            }

            return(collector);
        }
コード例 #7
0
        public void IOTest()
        {
            AnalyzerCollector collector = IntegrationTests.Analyze("IOPropertyValue.cpp");

            Assert.AreEqual(17, collector.Collection.Count);
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOElecTypeValue::IsValid", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOElecTypeValue::Set", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOElecTypeValue::Get", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOElecTypeValue::Pack", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::IOCompoundValue", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::operator ==", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::Set", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::Get", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::IsValid", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::ResetValue", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("IOCompoundValue::SetType", collector.Collection));

            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("OutboundConvertibleCompoundValue::OutboundConvertibleCompoundValue", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("OutboundConvertibleCompoundValue::Pack", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("DigitalOverrideValue::Unpack", collector.Collection));
            Assert.AreEqual(true, IntegrationTests.FunctionIsInCollection("DigitalOverrideValue::Get", collector.Collection));
        }
コード例 #8
0
ファイル: IntegrationTests.cs プロジェクト: Tallmaris/ccm
        private static AnalyzerCollector Analyze(string filename, bool suppressMethodSignature)
        {
            //TODO: start using SortedListener instead of AnalyzerCollector (remove this one)
              AnalyzerCollector collector = new AnalyzerCollector();

              StreamReader stream = new StreamReader(filename);

              try
              {
            FileAnalyzer analyzer =
              new FileAnalyzer(stream, collector, null, suppressMethodSignature, filename);

            analyzer.Analyze();
              }
              finally
              {
            stream.Dispose();
              }

              return collector;
        }