Example #1
0
		public override void Generate(string file, OutputHelper output)
		{
			output.GenerateLink(file);
		}
Example #2
0
        private RKResults DrawRes(RKResults r, RAlgSolver ra, string cn, string cnsuff, Color c, OutputHelper output,
                                  int eb, out double functional)
        {
            if (!isReal)
            {
                for (int i = 0; i < r.Count - setCount; i++)
                {
                    if (eb == 1)
                    {
                        if (setCount == 1)
                        {
                            (tblResList as List<ResPointViewType1>)[i + i*step].M1 = ra.itab[i];
                        }
                        else
                        {
                            (tblResList as List<ResPointViewType2>)[i + i*step].M1 = ra.itab[i];
                        }
                    }
                    else
                    {
                        if (setCount == 1)
                        {
                            (tblResList as List<ResPointViewType1>)[i + i*step].M2 = ra.itab[i];
                        }
                        else
                        {
                            (tblResList as List<ResPointViewType2>)[i + i*step].M2 = ra.itab[i];
                        }
                    }
                }
                grcTabRes.RefreshDataSource();
            }

            var sb = new StringBuilder();

            Dictionary<double, int> tt = GetTT(r, ra.itab);

            //-- draw res ---
            if (!curves.ContainsKey(cn))
            {
                curves.Add(cn, new PointPairList());
                var curve = new LineItem(cn, curves[cn], c, SymbolType.None);
                curve.Line.Style = DashStyle.Dash;
                curve.Line.Width = 2;
                //this.zgcMainChart2.MasterPane[1].CurveList.Add(curve);

                if (setCount == 2)
                {
                    curves.Add(cn + cnsuff, new PointPairList());
                    var curve1 = new LineItem(cn + cnsuff, curves[cn + cnsuff], c, SymbolType.None);
                    curve.Line.Style = DashStyle.Dash;
                    curve.Line.Width = 2;
                    zgcMainChart2.MasterPane[0].CurveList.Add(curve1);

                    zgcMainChart2.MasterPane[1].CurveList.Add(curve);
                }
                else
                {
                    zgcMainChart2.MasterPane[0].CurveList.Add(curve);
                }
            }
            else
            {
                curves[cn].Clear();
                if (setCount == 2)
                {
                    curves[cn + cnsuff].Clear();
                }
            }

            int k = 0;
            var listDraw = new List<TaskParameter>();
            for (int i = 0; i < tps.Count; i++)
            {
                var tpDraw = new TaskParameter(tps[i].Param.Length);
                string line = string.Format("{0}) ", i);
                for (int j = 0; j < tps[0].Param.Length; j++)
                {
                    tpDraw.Param[j] = ra.x[k];
                    line += string.Format("a{0}={1:f6} ", j, ra.x[k]);
                    k++;
                }
                sb.AppendLine(line);
                listDraw.Add(tpDraw);
            }
            sb.AppendLine("-----");

            var tps1 = new TaskParameters(listDraw, tt);
            var tw1 = new TaskWorker(tps1, funcDescr.GetType(), funcDescr.MainFuncName, funcDescr.SecFuncName, funcDescr);

            double t0, t1;
            if (!isReal)
            {
                t0 = double.Parse(txtT0.Text);
                t1 = double.Parse(txtT1.Text);
            }
            else
            {
                t0 = 0;
                t1 = ASignal.Count*0.01;
            }
            var rk1 = new RKVectorForm(tw1, cn, t0, t1, startVector);
            RKResults res1 = rk1.SolveWithConstH(res.Count - 1, RKMetodType.RK2_1);

            functional = GetDiff(res, res1);
            sb.Append(string.Format("f={0:f6}", functional));
            //rtb.Text = sb.ToString();
            //this.SetControlFeathe(rtb, "text=", sb.ToString());
            output.WriteLine(sb.ToString());

            int nn = setCount == 1 ? 1 : 2;
            for (int i = 0; i < res1.Count - nn; i++)
            {
                if (nn == 1)
                {
                    curves[cn].Add(res1[i].X, res1[i].Y[0]);
                }
                else
                {
                    curves[cn].Add(res1[i].Y[0], res1[i].Y[1]);
                    curves[cn + cnsuff].Add(res1[i].X, res1[i].Y[0]);
                }
            }
            SetControlProperty(zgcMainChart2, "chart", null);
            //this.zgcMainChart2.AxisChange();
            //this.zgcMainChart2.Refresh();
            return res1;
        }
Example #3
0
 public void ValueArray15_Test()
 {
     OutputHelper.WriteLine(" Section 4.1");
     OutputHelper.WriteLine(" uint is an alias for System.UInt32");
     ValueArrayTestClass15.testMethod();
 }
Example #4
0
 public void ValueArray01_Test()
 {
     OutputHelper.WriteLine(" Section 4.1");
     OutputHelper.WriteLine(" byte is an alias for System.Byte");
     ValueArrayTestClass01.testMethod();
 }
Example #5
0
        /// <summary>
        /// Run debuggee (without any debugger) and compare the console output to the regex specified.
        /// </summary>
        /// <param name="config">test config to use</param>
        /// <param name="output">output helper</param>
        /// <param name="testName">test case name</param>
        /// <param name="debuggeeName">debuggee name (no path)</param>
        /// <param name="outputRegex">regex to match on console (standard and error) output</param>
        /// <returns></returns>
        public static async Task <int> Run(TestConfiguration config, ITestOutputHelper output, string testName, string debuggeeName, string outputRegex)
        {
            OutputHelper outputHelper = null;

            try
            {
                // Setup the logging from the options in the config file
                outputHelper = ConfigureLogging(config, output, testName);

                // Restore and build the debuggee. The debuggee name is lower cased because the
                // source directory name has been lowercased by the build system.
                DebuggeeConfiguration debuggeeConfig = await DebuggeeCompiler.Execute(config, debuggeeName.ToLowerInvariant(), outputHelper);

                outputHelper.WriteLine("Starting {0}", testName);
                outputHelper.WriteLine("{");

                // Get the full debuggee launch command line (includes the host if required)
                string exePath   = debuggeeConfig.BinaryExePath;
                string arguments = debuggeeConfig.BinaryDirPath;
                if (!string.IsNullOrWhiteSpace(config.HostExe))
                {
                    exePath   = config.HostExe;
                    arguments = Environment.ExpandEnvironmentVariables(string.Format("{0} {1} {2}", config.HostArgs, debuggeeConfig.BinaryExePath, debuggeeConfig.BinaryDirPath));
                }

                TestLogger    testLogger    = new TestLogger(outputHelper.IndentedOutput);
                ProcessRunner processRunner = new ProcessRunner(exePath, arguments).
                                              WithLog(testLogger).
                                              WithTimeout(TimeSpan.FromMinutes(5));

                processRunner.Start();

                // Wait for the debuggee to finish before getting the debuggee output
                int exitCode = await processRunner.WaitForExit();

                string debuggeeStandardOutput = testLogger.GetStandardOutput();
                string debuggeeStandardError  = testLogger.GetStandardError();

                // The debuggee output is all the stdout first and then all the stderr output last
                string debuggeeOutput = debuggeeStandardOutput + debuggeeStandardError;
                if (string.IsNullOrEmpty(debuggeeOutput))
                {
                    throw new Exception("No debuggee output");
                }
                // Remove any CR's in the match string because this assembly is built on Windows (with CRs) and
                // ran on Linux/OS X (without CRs).
                outputRegex = outputRegex.Replace("\r", "");

                // Now match the debuggee output and regex match string
                if (!new Regex(outputRegex, RegexOptions.Multiline).IsMatch(debuggeeOutput))
                {
                    throw new Exception(string.Format("\nDebuggee output:\n\n'{0}'\n\nDid not match the expression:\n\n'{1}'", debuggeeOutput, outputRegex));
                }

                return(exitCode);
            }
            catch (Exception ex)
            {
                // Log the exception
                outputHelper?.WriteLine(ex.ToString());
                throw;
            }
            finally
            {
                outputHelper?.WriteLine("}");
                outputHelper?.Dispose();
            }
        }