public void ParseData_InvalidDataTooShort_ThrowsException() { byte[] data; data = HelperFunctions.ConvertHex(cDATA_INVALID); OutputParser.Parse(data); }
public void ParseStream_EmptyData_ThrowsException() { MemoryStream stream = new MemoryStream { Capacity = 0 }; OutputParser.Parse(stream); }
public void ParseStream_InvalidDataTooShort_ThrowsException() { byte[] data; MemoryStream stream; data = HelperFunctions.ConvertHex(cDATA_INVALID); stream = new MemoryStream(data); OutputParser.Parse(stream); }
internal DisassemblyResult Disassemble(Benchmark benchmark, MonoRuntime mono) { Debug.Assert(mono == null || !RuntimeInformation.IsMono(), "Must never be called for Non-Mono benchmarks"); var monoMethodName = GetMethodName(benchmark.Target); var output = ProcessHelper.RunAndReadOutputLineByLine( mono?.CustomPath ?? "mono", "-v -v -v -v " + $"--compile {monoMethodName} " + (benchmark.Job.Env.Jit == Jit.Llvm ? "--llvm" : "--nollvm") + $" \"{benchmark.Target.Type.GetTypeInfo().Assembly.Location}\""); return(OutputParser.Parse(output, monoMethodName, benchmark.Target.Method.Name)); }
public void ParseData_ValidData_IsValid() { byte[] data; Output result; byte[] scriptSig; data = HelperFunctions.ConvertHex(cDATA_VALID); result = OutputParser.Parse(data); Assert.IsNotNull(result); scriptSig = HelperFunctions.ConvertHex(cVALID_SCRIPTSIG); Assert.AreEqual(result.ScriptPubKey.Length, scriptSig.Length); Assert.IsTrue(result.ScriptPubKey.SequenceEqual(scriptSig)); Assert.AreEqual(result.Value, cVALID_VALUE); }
internal DisassemblyResult Disassemble(Benchmark benchmark, MonoRuntime mono) { Debug.Assert(mono == null || !RuntimeInformation.IsMono, "Must never be called for Non-Mono benchmarks"); var benchmarkTarget = benchmark.Target; string fqnMethod = GetMethodName(benchmarkTarget); string exePath = benchmarkTarget.Type.GetTypeInfo().Assembly.Location; var environmentVariables = new Dictionary <string, string> { ["MONO_VERBOSE_METHOD"] = fqnMethod }; string monoPath = mono?.CustomPath ?? "mono"; string arguments = $"--compile {fqnMethod} {exePath}"; var output = ProcessHelper.RunAndReadOutputLineByLine(monoPath, arguments, environmentVariables, includeErros: true); string commandLine = $"{GetEnvironmentVariables(environmentVariables)} {monoPath} {arguments}"; return(OutputParser.Parse(output, benchmarkTarget.Method.Name, commandLine)); }
internal void AppendText(string text) { if (string.IsNullOrWhiteSpace(text)) { return; } this.SuspendLayout(); this.BeginUpdate(); outputParser.Parse(text); text = text.TrimEnd(new[] { ' ', '\n', '\r', '\t' }); switch (outputParser.State) { case OutputState.BuildBegin: var tn = AddItem(BuildIcons.BeginEnd, text); break; case OutputState.Cleaning: tn = AddItem(BuildIcons.Clean, "Cleaning " + GetRelativeOutputPath(outputParser.Filename)); tn.ToolTipText = text; AddSubItem(tn, text); break; case OutputState.Skipping: tn = AddItem(BuildIcons.Skip, "Skipping " + GetRelativePath(outputParser.Filename)); tn.ToolTipText = text; AddSubItem(tn, text); break; case OutputState.BuildAsset: tn = AddItem(BuildIcons.Skip, "Building " + GetRelativePath(outputParser.Filename)); tn.ToolTipText = text; AddSubItem(tn, text); break; case OutputState.BuildError: _lastTreeNode.ImageIndex = BuildIcons.Fail; _lastTreeNode.SelectedImageIndex = BuildIcons.Fail; _lastTreeNode.ToolTipText += Environment.NewLine + Environment.NewLine + outputParser.ErrorMessage; AddSubItem(_lastTreeNode, outputParser.ErrorMessage).ForeColor = System.Drawing.Color.DarkRed; break; case OutputState.BuildErrorContinue: _lastTreeNode.ToolTipText += Environment.NewLine + outputParser.ErrorMessage; AddSubItem(_lastTreeNode, outputParser.ErrorMessage).ForeColor = System.Drawing.Color.DarkRed; break; case OutputState.BuildEnd: tn = AddItem(BuildIcons.BeginEnd, text); break; case OutputState.BuildTime: _lastTreeNode.Text = _lastTreeNode.Text.TrimEnd(new[] { '.', ' ' }) + ", " + text; SendMessage(this.Handle, WM_VSCROLL, SB_BOTTOM, 0); //scroll down to the end break; } _prevFilename = outputParser.Filename; this.EndUpdate(); this.ResumeLayout(); }
public void ParseStream_NullData_ThrowsException() { OutputParser.Parse(null as Stream); }
public void ParseData_NullData_ThrowsException() { OutputParser.Parse(null as byte[]); }
public void ParseData_EmptyData_ThrowsException() { OutputParser.Parse(new byte[0]); }
public void OutputParserParse() { int errorCount = 0, warningCount = 0; Logger errorLogger = (errorCode, file, lineNumber, message) => errorCount++; Logger warningLogger = (errorCode, file, lineNumber, message) => warningCount++; OutputParser parser = new OutputParser("FxCopTask.xml", errorLogger, warningLogger); Assert.IsFalse(parser.Parse(true, false)); Assert.AreEqual(15, errorCount); Assert.AreEqual(0, warningCount); }
public void WriteLine(string singleLineOutput, bool sendPrompt = true) { var buffer = singleLineOutput.ToCharArray(); FinalWrite(OutputParser.Parse(buffer, buffer.Length, Connection.TerminalOptions), sendPrompt); }