Skip to content

Commit

Permalink
fix(scale_pattern): check for descendingIntervalSteps in == (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertms10 authored May 20, 2023
1 parent 0dc24bd commit fbce358
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/src/scale/scale_pattern.dart
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,10 @@ final class ScalePattern {
@override
bool operator ==(Object other) =>
other is ScalePattern &&
const ListEquality<Interval>().equals(intervalSteps, other.intervalSteps);
const ListEquality<Interval>()
.equals(intervalSteps, other.intervalSteps) &&
const ListEquality<Interval>()
.equals(_descendingIntervalSteps, other._descendingIntervalSteps);

@override
int get hashCode => Object.hashAll(intervalSteps);
Expand Down
22 changes: 22 additions & 0 deletions test/src/scale/scale_pattern_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,35 @@ void main() {
ScalePattern.ionian,
ScalePattern.mixolydian,
ScalePattern.wholeTone,
// Melodic minor scale (ascending only)
const ScalePattern([
Interval.majorSecond,
Interval.minorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.minorSecond,
]),
ScalePattern.melodicMinor,
};
collection.addAll(collection);
expect(collection.toList(), const [
ScalePattern.major,
ScalePattern.aeolian,
ScalePattern.mixolydian,
ScalePattern.wholeTone,
// Melodic minor scale (ascending only)
ScalePattern([
Interval.majorSecond,
Interval.minorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.majorSecond,
Interval.minorSecond,
]),
ScalePattern.melodicMinor,
]);
});
});
Expand Down

0 comments on commit fbce358

Please sign in to comment.