From ba43ebaa26ef165038c5ed9a2e07dda01e4aaa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Ma=C3=B1osa?= Date: Sat, 15 Apr 2023 02:14:02 +0200 Subject: [PATCH] test(interval): add test cases for `inverted` (#53) --- .../interval/int_interval_extension_test.dart | 11 +++++++ test/src/interval/interval_test.dart | 29 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/test/src/interval/int_interval_extension_test.dart b/test/src/interval/int_interval_extension_test.dart index d5a5786a..8af67d66 100644 --- a/test/src/interval/int_interval_extension_test.dart +++ b/test/src/interval/int_interval_extension_test.dart @@ -102,5 +102,16 @@ void main() { expect(13.simplified, 6); }); }); + + group('.inverted', () { + test('should return the inverted int interval', () { + expect(2.inverted, 7); + expect(4.inverted, 5); + expect(8.inverted, 1); + expect(9.inverted, 7); + expect(10.inverted, 6); + expect(13.inverted, 3); + }); + }); }); } diff --git a/test/src/interval/interval_test.dart b/test/src/interval/interval_test.dart index 6f4fdca5..7bf83bcc 100644 --- a/test/src/interval/interval_test.dart +++ b/test/src/interval/interval_test.dart @@ -277,6 +277,35 @@ void main() { }); }); + group('.inverted', () { + test('should return the inverted of this Interval', () { + expect( + const Interval.perfect(1, PerfectQuality.augmented).inverted, + const Interval.perfect(8, PerfectQuality.diminished), + ); + expect( + const Interval.perfect(1, PerfectQuality.perfect).inverted, + const Interval.perfect(8, PerfectQuality.perfect), + ); + expect( + const Interval.imperfect(2, ImperfectQuality.major).inverted, + const Interval.imperfect(7, ImperfectQuality.minor), + ); + expect( + const Interval.imperfect(3, ImperfectQuality.minor).inverted, + const Interval.imperfect(6, ImperfectQuality.major), + ); + expect( + const Interval.perfect(5, PerfectQuality.diminished).inverted, + const Interval.perfect(4, PerfectQuality.augmented), + ); + expect( + const Interval.perfect(4, PerfectQuality.diminished).inverted, + const Interval.perfect(5, PerfectQuality.augmented), + ); + }); + }); + group('.toString()', () { test('should return the string representation of this Interval', () { expect(