コード例 #1
0
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        private void BaseTest(CLoadFilesOptions target)
        {
            Assert.IsNotNull(target);
            Assert.AreEqual(target.Directory, directory);
            Assert.AreEqual(target.FileExtensions.Count, file_extensions_count);
            Assert.IsFalse(target.MustWorkWithOneFile);
        }
コード例 #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="LanguageID"></param>
 /// <param name="load_files_options"></param>
 public CSyntacticUnitsInfoProvider(LANGUAGES LanguageID, CLoadFilesOptions load_files_options)
     : base(load_files_options)
 {
     m_Extension             = CAvailableExtentions.GetExtention(LanguageID);
     m_SynUnitsCollection    = new CSyntacticUnitsCollection();
     m_CountOfSyntacticUnits = 0;
 }
コード例 #3
0
        public void SetFileExtensionsTest()
        {
            CLoadFilesOptions target = CommotTest();

            target.SetFileExtensions(file_extensions);
            Assert.AreEqual(target.FileExtensions.Count, file_extensions_count);
            Assert.AreEqual(target.FileExtensions[0], ".xxx");
        }
コード例 #4
0
        public void SetFileEncodingTest()
        {
            CLoadFilesOptions target = CommotTest();
            Encoding          value  = Encoding.GetEncoding(CODE_PAGE);

            target.SetFileEncoding(value);
            Assert.AreEqual(target.FileEncoding, files_encoding);
        }
コード例 #5
0
        public void SetDirectoryTest()
        {
            CLoadFilesOptions target = CommotTest();

            target.SetDirectory(directory);
            Assert.AreEqual(target.Directory, directory);
            Assert.IsFalse(target.MustWorkWithOneFile);
        }
コード例 #6
0
        public void CLoadFilesOptionsConstructorTest3()
        {
            CLoadFilesOptions target = new CLoadFilesOptions(path_to_file);

            Assert.IsNotNull(target);
            Assert.IsTrue(target.MustWorkWithOneFile);
            Assert.AreEqual(target.PathToFile, path_to_file);
        }
コード例 #7
0
        public void CLoadFilesOptionsConstructorTest2()
        {
            CCodePreProcessingOptions Options = new CCodePreProcessingOptions();
            CLoadFilesOptions         target  = new CLoadFilesOptions(directory, file_extensions, files_encoding, Options);

            BaseTestEx(target);
            Assert.AreEqual(target.PreProcessingOptions, Options);
        }
コード例 #8
0
        public void SetPreProcessingOptionsTest()
        {
            CLoadFilesOptions         target = CommotTest();
            CCodePreProcessingOptions value  = new CCodePreProcessingOptions();

            target.SetPreProcessingOptions(value);
            Assert.AreEqual(value, target.PreProcessingOptions);
        }
コード例 #9
0
        public void SetIsUseParallelExtensionsTest()
        {
            CLoadFilesOptions target = CommotTest();

            bool value = !target.IsUseParallelExtensions;

            target.SetIsUseParallelExtensions(value);
            Assert.AreEqual(value, target.IsUseParallelExtensions);
        }
コード例 #10
0
        public void SetIsPreProcessingFileTest()
        {
            CLoadFilesOptions target = CommotTest();

            Assert.IsFalse(target.IsPreProcessingFile);

            target.SetIsPreProcessingFile(true);
            Assert.IsTrue(target.IsPreProcessingFile);
        }
コード例 #11
0
        private CLoadFilesOptions CommotTest()
        {
            CLoadFilesOptions target = new CLoadFilesOptions();

            Assert.IsNotNull(target);
            Assert.IsFalse(target.MustWorkWithOneFile);
            Assert.AreEqual(target.Directory, string.Empty);
            Assert.AreEqual(target.PathToFile, string.Empty);

            return(target);
        }
コード例 #12
0
        public void SetPathToFileTest()
        {
            CLoadFilesOptions target = CommotTest();

            target.SetPathToFile(path_to_file);
            Assert.AreEqual(target.PathToFile, path_to_file);
            Assert.AreEqual(target.Directory, string.Empty);
            Assert.IsTrue(target.MustWorkWithOneFile);

            target.SetPathToFile(string.Empty);
        }
コード例 #13
0
        public void SetSkippingFoldersTest()
        {
            CLoadFilesOptions target = CommotTest();

            Assert.AreEqual(target.SkippingFolders, string.Empty);

            string value = "rttt, dfsdf, sdfsdf";

            target.SetSkippingFolders(value);
            Assert.AreEqual(target.SkippingFolders, value);
        }
コード例 #14
0
        private CSyntacticInfo calc(string testfile)
        {
            string filename = Path.GetFullPath(testfile);

            Assert.IsTrue(File.Exists(filename));

            LANGUAGES                   lang = LANGUAGES.LANGUAGE_C_SHARP;
            CLoadFilesOptions           load_files_options = new CLoadFilesOptions(filename);
            CSyntacticUnitsInfoProvider target             = new CSyntacticUnitsInfoProvider(lang, load_files_options);

            return(target.Calculate());
        }
コード例 #15
0
        //protected CBaseCloneSearchExecutor()
        //   : this(CAvailableCloneSearchAlgorithms.GetAlgorithm(CloneSearchAlgoritms.HashBucketAlgorithm))
        //{}

        public CBaseCloneSearchExecutor(CBaseCloneSearchStrategy search_algorithm, ICloneExtension ext)
        {
            m_ext = ext;
            m_ProcessedClonesCounter = 0;
            m_ReportingCounter       = 0;
            m_MessageEventArgs       = new MessageEventArgs();
            m_LoadFilesOptions       = new CLoadFilesOptions();
            m_FilesList           = new CModifiableSourceFilesList(m_ext);
            m_CloneSearchProvider = new CCloneSearchProvider(search_algorithm);
            InitBackgroundThread();
            m_CloneSearchProvider.InitCloneSearchCallbacks(new EventHandler(ReportCloneSearchStart), new EventHandler(ReportCloneSearchProgress), new EventHandler(ReportCloneSearchEnd));
            //m_FilesList.InitFilesListBuildingCallbacks(new EventHandler(ReportFilesListBuildingStart), null, new EventHandler(ReportFilesListBuildingEnd));
            //m_FilesList.InitLoadFilesCallbacks(new EventHandler(ReportLoadFilesStart), new EventHandler(ReportLoadFilesProgress), null);
        }
コード例 #16
0
ファイル: CloneSearchWindow.cs プロジェクト: mfvanek/i-clone
        private void PrepareLoadFilesOptions()
        {
            ICloneExtension     Ext              = ChooseLangComboBox.SelectedItem as ICloneExtension;
            CICloneEncodingInfo EncodeInfo       = CodeEncodingComboBox.SelectedItem as CICloneEncodingInfo;
            CLoadFilesOptions   LoadFilesOptions = new CLoadFilesOptions(CodeLocationTextBox.Text, ChoosenFilesExtensionsTextBox.Text, EncodeInfo.GetEncodingInfo().GetEncoding(), new CCodePreProcessingOptions(Ext.GetCommentSymbols()));

            LoadFilesOptions.SetSkippingFolders(Properties.Settings.Default.CSWSkippingFolders);
            LoadFilesOptions.SetIsUseParallelExtensions(Properties.Settings.Default.CSWIsUseParallelExtensions);

            m_CloneSearchExecutor.SetLoadFilesOptions(LoadFilesOptions);
            if (AutomaticKminCalculationCheckBox.Checked)
            {
                CCodeSizeDetector Counter = new CCodeSizeDetector(Ext.LanguageID(), new CLoadFilesOptions(CodeLocationTextBox.Text, ChoosenFilesExtensionsTextBox.Text));
                //Counter.LoadFilesProgress += new EventHandler(ReportProgress);
                CSyntacticInfo info = Counter.Calculate();
                CCodeFragment.SetKmin(info.Kmin);
            }
            else
            {
                CCodeFragment.SetKmin((long)KminValue.Value);
            }
            m_CloneSearchExecutor.Extension = Ext;
        }
コード例 #17
0
ファイル: CCodeSizeDetector.cs プロジェクト: mfvanek/i-clone
 /// <summary>
 /// Конструктор по умолчанию
 /// </summary>
 public CCodeSizeDetector(LANGUAGES LanguageID, CLoadFilesOptions load_files_options)
     : base(LanguageID, load_files_options)
 {
     ClearCounters();
 }
コード例 #18
0
 public void SetLoadFilesOptions(CLoadFilesOptions LoadFilesOptions)
 {
     m_LoadFilesOptions = LoadFilesOptions;
     m_FilesList.SetLoadFilesOptions(LoadFilesOptions);
 }
コード例 #19
0
        public void CLoadFilesOptionsConstructorTest()
        {
            CLoadFilesOptions target = new CLoadFilesOptions(directory, file_extensions);

            BaseTest(target);
        }
コード例 #20
0
 private void BaseTestEx(CLoadFilesOptions target)
 {
     BaseTest(target);
     Assert.AreEqual(target.FileEncoding, files_encoding);
 }
コード例 #21
0
 public void CLoadFilesOptionsConstructorTest4()
 {
     CLoadFilesOptions target = CommotTest();
 }
コード例 #22
0
        public void CLoadFilesOptionsConstructorTest1()
        {
            CLoadFilesOptions target = new CLoadFilesOptions(directory, file_extensions, files_encoding);

            BaseTestEx(target);
        }