< Summary

Information
Class: MusicTheory.Theory.Harmony.TraceExporter
Assembly: MusicTheory
File(s): /home/runner/work/MusicTheory/MusicTheory/Theory/Harmony/TraceExporter.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 21
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToMarkdown(...)100%44100%

File(s)

/home/runner/work/MusicTheory/MusicTheory/Theory/Harmony/TraceExporter.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using System.Text;
 3
 4namespace MusicTheory.Theory.Harmony;
 5
 6public static class TraceExporter
 7{
 8    public static string ToMarkdown(IReadOnlyList<KeyEstimator.TraceEntry> trace)
 9    {
 110        var sb = new StringBuilder();
 111        sb.AppendLine("| idx | key | total | stay | max | 2nd | tops | out | vl |");
 112        sb.AppendLine("|---:|:---:|---:|:---:|---:|---:|---:|---:|:---:|");
 613        foreach (var t in trace)
 14        {
 215            var keyStr = (t.ChosenKey.IsMajor ? "M" : "m") + "@" + (((t.ChosenKey.TonicMidi % 12) + 12) % 12);
 216            var vl = $"r={(t.VLRangeViolation ? 1 : 0)},s={(t.VLSpacingViolation ? 1 : 0)},o={(t.VLOverlap ? 1 : 0)},p={
 217            sb.AppendLine($"| {t.Index} | {keyStr} | {t.Total} | {(t.StayedDueToHysteresis ? 1 : 0)} | {t.MaxScore} | {t
 18        }
 119        return sb.ToString();
 20    }
 21}