Skip to content

Commit

Permalink
[C#] Sanitize names in coverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
aman-goel committed Oct 4, 2023
1 parent 58cb49a commit aef7289
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions Src/PChecker/CheckerCore/Coverage/ActivityCoverageReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ internal void WriteCoverageText(TextWriter writer)
foreach (var machine in machines)
{
machineTypes.TryGetValue(machine, out var machineType);
WriteHeader(writer, string.Format("{0}: {1}", machineType, machine));
WriteHeader(writer, string.Format("{0}: {1}", machineType, GetSanitizedName(machine)));

// find all possible events for this machine.
var uncoveredMachineEvents = new Dictionary<string, HashSet<string>>();
Expand Down Expand Up @@ -314,7 +314,11 @@ private IEnumerable<string> GetPushedStates(string stateId)

private static List<string> SortHashSet(HashSet<string> items)
{
var sorted = new List<string>(items);
var sorted = new List<string>();
foreach (var i in items)
{
sorted.Add(GetSanitizedName(i));
}
sorted.Sort();
return sorted;
}
Expand Down Expand Up @@ -349,5 +353,15 @@ private static string GetMachineId(string nodeId)

private static string GetStateId(string machineName, string stateName) =>
string.Format("{0}::{1}", stateName, machineName);

private static string GetSanitizedName(string name)
{
if (name.StartsWith("PImplementation."))
{
return name.Substring("PImplementation.".Length);
}

return name;
}
}
}

0 comments on commit aef7289

Please sign in to comment.