GetByName() private static method

private static GetByName ( List metrics, string nameOfFunction ) : CCMEngine.ccMetric
metrics List
nameOfFunction string
return CCMEngine.ccMetric
Ejemplo n.º 1
0
        public void TestFileWithTabAfterEndif()
        {
            string         filename = "FileWithTabAfterEndIf.c"; // this is deployed through local.testsettings
            SortedListener listener = new SortedListener(10, new List <string>(), 0);

            using (StreamReader stream = new StreamReader(filename))
            {
                FileAnalyzer analyzer = new FileAnalyzer(stream, listener, null, true, filename);
                analyzer.Analyze();

                Assert.AreEqual(1, listener.Metrics.Count);

                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "Foo"));
            }
        }
Ejemplo n.º 2
0
        public void TestCStyleFuncDecl()
        {
            string         filename = "cstylefuncs.c"; // this is deployed through local.testsettings
            SortedListener listener = new SortedListener(10, new List <string>());

            using (StreamReader stream = new StreamReader(filename))
            {
                FileAnalyzer analyzer = new FileAnalyzer(stream, listener, null, true, filename);
                analyzer.Analyze();

                Assert.AreEqual(3, listener.Metrics.Count);

                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "added"));
                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "new_cfg_record"));
                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "edit_cfg_record"));
            }
        }
Ejemplo n.º 3
0
        public void TestTypescriptFileIsCorrectlyParsed()
        {
            string         filename = "TypeScript.ts"; // this is deployed through local.testsettings
            SortedListener listener = new SortedListener(10, new List <string>());

            using (StreamReader stream = new StreamReader(filename))
            {
                FileAnalyzer analyzer = new FileAnalyzer(stream, listener, null, false, filename);
                analyzer.Analyze();

                Assert.AreEqual(3, listener.Metrics.Count);

                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "Sayings::Greeter::greet()"));
                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "Sayings::Greeter::constructor(message:string)"));
                Assert.IsNotNull(IntegrationTests.GetByName(listener.Metrics, "button.onclick()"));
            }
        }
Ejemplo n.º 4
0
        public void TestJavascriptFileContainsAllFunctions()
        {
            string         filename = "examples.js"; // this is deployed through local.testsettings
            SortedListener listener = new SortedListener(10, new List <string>());

            using (StreamReader stream = new StreamReader(filename))
            {
                FileAnalyzer analyzer = new FileAnalyzer(stream, listener, null, false, filename);
                analyzer.Analyze();

                Assert.AreEqual(10, listener.Metrics.Count);

                Assert.AreEqual(6, IntegrationTests.GetByName(listener.Metrics, "gcd(segmentA,segmentB)").CCM);
                Assert.AreEqual(2, IntegrationTests.GetByName(listener.Metrics, "function(monkey)").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "localFunction()").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "Some.Foo(args)").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "functionWithColon()").CCM);
                Assert.AreEqual(2, IntegrationTests.GetByName(listener.Metrics, "localFunction1()").CCM);
                Assert.AreEqual(4, IntegrationTests.GetByName(listener.Metrics, "outerFunction1()").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "localFunction2()").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "Monkey::feedMonkey()").CCM);
                Assert.AreEqual(1, IntegrationTests.GetByName(listener.Metrics, "afterMonkeyFeed()").CCM);
            }
        }