Skip to content

Commit

Permalink
added tests to check performance information
Browse files Browse the repository at this point in the history
  • Loading branch information
HJLebbink committed Sep 2, 2016
1 parent e3a46f9 commit 17929a8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
13 changes: 8 additions & 5 deletions VS/CSHARP/intrinsics-dude-vsix/Tools/IntrinsicDataElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,17 @@ private static IList<Run> makePerformance(string str)
run.FontStyle = FontStyles.Italic;
list.Add(run);

string str2 = str.Replace("&lt;", "<").Replace("&gt;", ">").Replace("<tbody>","").Replace("</tbody>","").Replace("<tr>","").Replace("<td>","");
string str2 = str.Replace("&lt;", "<").Replace("&gt;", ">").Replace("<tbody>", "").Replace("</tbody>", "").Replace("<tr>", "").Replace("<td>", "");
string[] lines = str2.Split(new string[] { "</tr>" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i<lines.Length; ++i)
for (int i = 1; i < lines.Length; ++i)
{
string[] elements = lines[i].Split(new string[] { "</td>" }, StringSplitOptions.RemoveEmptyEntries);
Run run1 = new Run(string.Format("{0,-20}{1,-10}{2,-10}\n", elements[0], elements[1], elements[2]));
run1.FontFamily = family;
list.Add(run1);
if (elements.Length == 3)
{
Run run1 = new Run(string.Format("{0,-20}{1,-10}{2,-10}\n", elements[0], elements[1], elements[2]));
run1.FontFamily = family;
list.Add(run1);
}
}
return list;
}
Expand Down
21 changes: 20 additions & 1 deletion VS/CSHARP/intrinsics-dude-vsix/Tools/IntrinsicStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ private void loadHtml(string filename)
case "DESCRIPTION": dataElement.description = addAcronyms(removeHtml(element2.InnerText)); break;
case "OPERATION": dataElement.operation = addAcronyms(removeHtml(element2.InnerHtml)); break;
case "CPUID": dataElement.cpuID |= IntrinsicTools.parseCpuID(element2.InnerText); break;
case "PERFORMANCE": dataElement.performance = element2.InnerHtml; break;
case "PERFORMANCE":
dataElement.performance = element2.InnerHtml;
testPerformance(dataElement.performance);
break;
case "INSTRUCTION_NOTE": dataElement.instructionNote = element2.InnerText; break;

case "SIG":
Expand Down Expand Up @@ -222,6 +225,22 @@ private void loadHtml(string filename)
IntrinsicsDudeToolsStatic.Output("ERROR: IntrinsicStore: loadHtml: exception " + e.ToString());
}
}
/// <summary>
/// Checks whether the performance string is ok
/// </summary>
private static void testPerformance(string str)
{
string str2 = str.Replace("&lt;", "<").Replace("&gt;", ">").Replace("<tbody>", "").Replace("</tbody>", "").Replace("<tr>", "").Replace("<td>", "");
string[] lines = str2.Split(new string[] { "</tr>" }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 1; i < lines.Length; ++i)
{
string[] elements = lines[i].Split(new string[] { "</td>" }, StringSplitOptions.RemoveEmptyEntries);
if (elements.Length != 3)
{
IntrinsicsDudeToolsStatic.Output("WARNING: IntrinsicStore: testPerformance");
}
}
}

private void saveXml(string filename)
{
Expand Down

0 comments on commit 17929a8

Please sign in to comment.