Example #1
0
        public void SetUp()
        {
            builder = new UnigramSwumBuilder {
                Splitter = new CamelIdSplitter()
            };
            var Generator = new SrcMLGenerator(@"..\..\External\SrcML");
            var file      = Generator.GenerateSrcMLFileFromDirectory(@"..\..\", Path.GetTempFileName(), new List <string>(), Language.Any);

            functions = from func in file.GetXDocument().Descendants()
                        where _functionTypes.Contains(func.Name) && !func.Ancestors(SRC.Declaration).Any()
                        select func;
        }
Example #2
0
        public void ExclusionFilterTest()
        {
            var exclusionList = new List <string>();

            exclusionList.Add("srcmltest\\bar.c");

            var doc = generator.GenerateSrcMLFileFromDirectory("srcmltest", "srcml_xml\\exclusionfilter.xml", exclusionList, Language.C);

            var    numFileUnits    = doc.FileUnits.Count();
            string firstSourceFile = null;

            if (numFileUnits > 0)
            {
                firstSourceFile = doc.FileUnits.First().Attribute("filename").Value;
            }

            Assert.AreEqual(1, numFileUnits, "test.xml should have only one file in it");
            Assert.AreEqual(Path.GetFullPath("srcmltest\\foo.c"), firstSourceFile);
        }