private static bool IsMyCode(FunctionInformation funcInfo) { return(!String.IsNullOrWhiteSpace(funcInfo.Filename) && funcInfo.Filename.IndexOfAny(_invalidPathChars) == -1 && funcInfo.Filename.IndexOf("\\node_modules\\") == -1 && Path.IsPathRooted(funcInfo.Filename)); }
public MinimumSearchMethodExecutor(FunctionInformation fInfo, MinimumSearchForm form) { _functionInfo = fInfo; _myForm = form; _currentMathMethod = MethodType.ScanMethod; _thread = new Thread(StartScanMethodScan); MaxValueY = 1; MinValueY = -1; _intervals = new List <Interval>(); }
public MinimumSearchForm() { var function = new FunctionInformation(); _minExecutor = new MinimumSearchMethodExecutor(function, this); InitializeComponent(); RB_Scan.Select(); RParameterLabel.Hide(); RParameterValue.Hide(); Save_is_correct_label.Hide(); Save_is_not_correct_label.Hide(); FSin_value.Text = "1"; SSin_value.Text = "1"; FCos_value.Text = "1"; SCos_value.Text = "1"; }
private void DiscoverTests(Dictionary <string, List <TestFileEntry> > testItems, MSBuild.Project proj, ITestCaseDiscoverySink discoverySink, IMessageLogger logger) { var result = new List <TestFrameworks.NodejsTestInfo>(); var projectHome = Path.GetFullPath(Path.Combine(proj.DirectoryPath, ".")); var projSource = proj.FullPath; var nodeExePath = Nodejs.GetAbsoluteNodeExePath( projectHome, proj.GetPropertyValue(NodeProjectProperty.NodeExePath)); if (!File.Exists(nodeExePath)) { logger.SendMessage(TestMessageLevel.Error, string.Format(CultureInfo.CurrentCulture, "Node.exe was not found. Please install Node.js before running tests.")); return; } var testCount = 0; foreach (var testFx in testItems.Keys) { var testFramework = GetTestFrameworkObject(testFx); if (testFramework == null) { logger.SendMessage(TestMessageLevel.Warning, string.Format(CultureInfo.CurrentCulture, "Ignoring unsupported test framework {0}", testFx)); continue; } var fileList = testItems[testFx]; var files = string.Join(";", fileList.Select(p => p.File)); logger.SendMessage(TestMessageLevel.Informational, string.Format(CultureInfo.CurrentCulture, "Processing: {0}", files)); var discoveredTestCases = testFramework.FindTests(fileList.Select(p => p.File), nodeExePath, logger, projectHome); testCount += discoveredTestCases.Count; foreach (var discoveredTest in discoveredTestCases) { var qualifiedName = discoveredTest.FullyQualifiedName; logger.SendMessage(TestMessageLevel.Informational, string.Format(CultureInfo.CurrentCulture, " " /*indent*/ + "Creating TestCase:{0}", qualifiedName)); //figure out the test source info such as line number var filePath = discoveredTest.ModulePath; var entry = fileList.Find(p => p.File.Equals(filePath, StringComparison.OrdinalIgnoreCase)); FunctionInformation fi = null; if (entry.IsTypeScriptTest) { fi = SourceMapper.MaybeMap(new FunctionInformation(string.Empty, discoveredTest.TestName, discoveredTest.SourceLine, entry.File)); } discoverySink.SendTestCase( new TestCase(qualifiedName, TestExecutor.ExecutorUri, projSource) { CodeFilePath = (fi != null) ? fi.Filename : filePath, LineNumber = (fi != null && fi.LineNumber.HasValue) ? fi.LineNumber.Value : discoveredTest.SourceLine, DisplayName = discoveredTest.TestName }); } logger.SendMessage(TestMessageLevel.Informational, string.Format(CultureInfo.CurrentCulture, "Processing finished for framework of {0}", testFx)); } if (testCount == 0) { logger.SendMessage(TestMessageLevel.Warning, string.Format(CultureInfo.CurrentCulture, "Discovered 0 testcases.")); } }
private void DiscoverTests(Dictionary <string, HashSet <TestFileEntry> > testItems, MSBuild.Project proj, ITestCaseDiscoverySink discoverySink, IMessageLogger logger) { var result = new List <NodejsTestInfo>(); var projectHome = Path.GetFullPath(Path.Combine(proj.DirectoryPath, ".")); var projSource = proj.FullPath; var nodeExePath = Nodejs.GetAbsoluteNodeExePath( projectHome, proj.GetPropertyValue(NodeProjectProperty.NodeExePath)); if (!File.Exists(nodeExePath)) { logger.SendMessage(TestMessageLevel.Error, "Node.exe was not found. Please install Node.js before running tests."); return; } var testCount = 0; foreach (var testFx in testItems.Keys) { var testFramework = FrameworkDiscoverer.Instance.Get(testFx); if (testFramework == null) { logger.SendMessage(TestMessageLevel.Warning, $"Ignoring unsupported test framework '{testFx}'."); continue; } var fileList = testItems[testFx]; var files = string.Join(";", fileList.Select(p => p.FullPath)); logger.SendMessage(TestMessageLevel.Informational, string.Format(CultureInfo.CurrentCulture, "Processing: {0}", files)); var discoveredTestCases = testFramework.FindTests(fileList.Select(p => p.FullPath), nodeExePath, logger, projectRoot: projectHome); testCount += discoveredTestCases.Count(); foreach (var discoveredTest in discoveredTestCases) { var qualifiedName = discoveredTest.FullyQualifiedName; const string indent = " "; logger.SendMessage(TestMessageLevel.Informational, $"{indent}Creating TestCase:{qualifiedName}"); //figure out the test source info such as line number var filePath = discoveredTest.TestPath; var entry = fileList.First(p => StringComparer.OrdinalIgnoreCase.Equals(p.FullPath, filePath)); FunctionInformation fi = null; if (entry.IsTypeScriptTest) { fi = SourceMapper.MaybeMap(new FunctionInformation(string.Empty, discoveredTest.TestName, discoveredTest.SourceLine, entry.FullPath)); } var testcase = new TestCase(qualifiedName, NodejsConstants.ExecutorUri, projSource) { CodeFilePath = fi?.Filename ?? filePath, LineNumber = fi?.LineNumber ?? discoveredTest.SourceLine, DisplayName = discoveredTest.TestName }; testcase.SetPropertyValue(JavaScriptTestCaseProperties.TestFramework, testFx); testcase.SetPropertyValue(JavaScriptTestCaseProperties.NodeExePath, nodeExePath); testcase.SetPropertyValue(JavaScriptTestCaseProperties.ProjectRootDir, projectHome); testcase.SetPropertyValue(JavaScriptTestCaseProperties.WorkingDir, projectHome); testcase.SetPropertyValue(JavaScriptTestCaseProperties.TestFile, filePath); discoverySink.SendTestCase(testcase); } logger.SendMessage(TestMessageLevel.Informational, string.Format(CultureInfo.CurrentCulture, "Processing finished for framework '{0}'.", testFx)); } }