< Summary

Information
Class: MusicTheory.Theory.Analysis.AnalysisUtils
Assembly: MusicTheory
File(s): /home/runner/work/MusicTheory/MusicTheory/Theory/Analysis/AnalysisUtils.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 19
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Mod12(...)100%11100%
NormalizeToRoot(...)100%11100%
Signature(...)100%22100%

File(s)

/home/runner/work/MusicTheory/MusicTheory/Theory/Analysis/AnalysisUtils.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4
 5namespace MusicTheory.Theory.Analysis;
 6
 7public static class AnalysisUtils
 8{
 9    // Pitch class normalization helpers
 602510    public static int Mod12(int v) => ((v % 12) + 12) % 12;
 11
 12    // Rotate set so candidateRoot becomes 0
 13    public static int[] NormalizeToRoot(IEnumerable<int> pcs, int candidateRoot)
 108014        => pcs.Select(pc => Mod12(pc - candidateRoot)).Distinct().OrderBy(x=>x).ToArray();
 15
 16    // Canonical signature: hyphen-joined sorted pc list (e.g., 0-3-7-10)
 17    public static string Signature(IEnumerable<int> pcs)
 680318        => string.Join('-', pcs.Select(Mod12).Distinct().OrderBy(x=>x));
 19}