• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

albertms10 / music_notes / 23773147639

30 Mar 2026 11:42PM UTC coverage: 98.558% (-1.4%) from 100.0%
23773147639

Pull #705

github

web-flow
Merge 322e71f14 into c5516e2c0
Pull Request #705: refactor!: 💥 rewrite `toString` into a more succinct `format` method

44 of 70 new or added lines in 24 files covered. (62.86%)

2 existing lines in 1 file now uncovered.

1777 of 1803 relevant lines covered (98.56%)

1.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/lib/src/harmony/harmonic_function.dart
1
import 'package:collection/collection.dart'
2
    show ListEquality, UnmodifiableListView;
3
import 'package:meta/meta.dart' show immutable;
4

5
import '../notation/notation_system.dart';
6
import '../scale/scale.dart';
7
import '../scale/scale_degree.dart';
8

9
/// A harmonic function.
10
///
11
/// ---
12
/// See also:
13
/// * [Scale].
14
/// * [ScaleDegree].
15
@immutable
16
class HarmonicFunction implements Formattable<HarmonicFunction> {
17
  final List<ScaleDegree> _scaleDegrees;
18

19
  /// The scale degrees that define this [HarmonicFunction].
20
  List<ScaleDegree> get scaleDegrees => UnmodifiableListView(_scaleDegrees);
3✔
21

22
  /// Creates a new [HarmonicFunction] from [_scaleDegrees].
23
  const HarmonicFunction(this._scaleDegrees);
1✔
24

25
  /// A I (tonic) degree [HarmonicFunction].
26
  static const i = HarmonicFunction([.i]);
27

28
  /// A II degree [HarmonicFunction].
29
  static const ii = HarmonicFunction([.ii]);
30

31
  /// A neapolitan sixth [HarmonicFunction].
32
  static const neapolitanSixth = HarmonicFunction([.neapolitanSixth]);
33

34
  /// A III degree [HarmonicFunction].
35
  static const iii = HarmonicFunction([.iii]);
36

37
  /// A IV degree [HarmonicFunction].
38
  static const iv = HarmonicFunction([.iv]);
39

40
  /// A dominant V degree [HarmonicFunction].
41
  static const dominantV = HarmonicFunction([ScaleDegree(5, quality: .major)]);
42

43
  /// A VI degree [HarmonicFunction].
44
  static const vi = HarmonicFunction([.vi]);
45

46
  /// A VII degree [HarmonicFunction].
47
  static const vii = HarmonicFunction([.vii]);
48

49
  /// The string representation of this [HarmonicFunction].
50
  ///
51
  /// Example:
52
  /// ```dart
53
  /// (HarmonicFunction.ii / .dominantV).format() == 'II/V'
54
  /// (HarmonicFunction.neapolitanSixth / .iv).format() == 'â™­II6/IV'
55
  /// ```
56
  @override
1✔
57
  String format() => _scaleDegrees.map((d) => d.format()).join('/');
5✔
58

NEW
59
  @override
×
NEW
60
  String toString() => '$runtimeType(scaleDegrees: $scaleDegrees)';
×
61

62
  /// Returns a new [HarmonicFunction] relating this [HarmonicFunction] to
63
  /// [other].
64
  ///
65
  /// Example:
66
  /// ```dart
67
  /// HarmonicFunction.dominantV / .dominantV / .dominantV
68
  ///   == HarmonicFunction([.v.major, .v.major, .v.major])
69
  /// ```
70
  HarmonicFunction operator /(HarmonicFunction other) =>
1✔
71
      HarmonicFunction([..._scaleDegrees, ...other._scaleDegrees]);
4✔
72

73
  @override
1✔
74
  bool operator ==(Object other) =>
75
      other is HarmonicFunction &&
1✔
76
      const ListEquality<ScaleDegree>().equals(
1✔
77
        _scaleDegrees,
1✔
78
        other._scaleDegrees,
1✔
79
      );
80

81
  @override
1✔
82
  int get hashCode => Object.hashAll(_scaleDegrees);
2✔
83
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc