-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
180 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,24 @@ | ||
{ | ||
"cSpell.ignoreWords": ["music"], | ||
"cSpell.words": ["cryptogrammatic", "latin"] | ||
"cSpell.words": [ | ||
"Abegg", | ||
"Alain", | ||
"arnold", | ||
"asch", | ||
"cryptogrammatic", | ||
"dmitri", | ||
"edvard", | ||
"Ferrarie", | ||
"franz", | ||
"gustav", | ||
"hercules", | ||
"jehan", | ||
"johann", | ||
"joseph", | ||
"latin", | ||
"niels", | ||
"paul", | ||
"robert", | ||
"Schostakowitsch" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:music_notes/music_notes.dart'; | ||
import 'package:note_names/model/cryptogram_scheme.dart'; | ||
|
||
void main() { | ||
group('CryptogramScheme', () { | ||
group('.schemes', () { | ||
test('should be a list of CryptogramSchemes', () { | ||
expect( | ||
CryptogramScheme.schemes, | ||
const TypeMatcher<List<CryptogramScheme>>(), | ||
); | ||
}); | ||
}); | ||
|
||
group('.cryptogramOf()', () { | ||
test('should return the musical cryptogram of name', () { | ||
final herculesDuxFerrarie = const CryptogramScheme.solmization() | ||
.cryptogramOf('Hercules Dux Ferrarie'); | ||
expect( | ||
herculesDuxFerrarie, | ||
[Note.d, Note.c, Note.d, Note.c, Note.d, Note.f, Note.e, Note.d], | ||
); | ||
|
||
final arnoldSchonberg = | ||
const CryptogramScheme.german().cryptogramOf('A. SCHBEG'); | ||
expect( | ||
arnoldSchonberg, | ||
[Note.a, Note.e.flat, Note.c, Note.b, Note.b.flat, Note.e, Note.g], | ||
); | ||
|
||
final belaBartok = | ||
const CryptogramScheme.french().cryptogramOf('BE BA'); | ||
expect(belaBartok, [Note.b, Note.e, Note.b, Note.a]); | ||
|
||
final carlPhilipEmmanuelBach = | ||
const CryptogramScheme.german().cryptogramOf('CFE BACH'); | ||
expect( | ||
carlPhilipEmmanuelBach, | ||
[Note.c, Note.f, Note.e, Note.b.flat, Note.a, Note.c, Note.b], | ||
); | ||
|
||
final dmitriSchostakowitsch = | ||
const CryptogramScheme.german().cryptogramOf('D. SCH'); | ||
expect(dmitriSchostakowitsch, [Note.d, Note.e.flat, Note.c, Note.b]); | ||
|
||
final edvardGrieg = const CryptogramScheme.french().cryptogramOf('EBG'); | ||
expect(edvardGrieg, [Note.e, Note.b, Note.g]); | ||
|
||
final franzSchubert = | ||
const CryptogramScheme.german().cryptogramOf('F. SCH'); | ||
expect(franzSchubert, [Note.f, Note.e.flat, Note.c, Note.b]); | ||
|
||
final gustavHolst = | ||
const CryptogramScheme.german().cryptogramOf('GSAH'); | ||
expect(gustavHolst, [Note.g, Note.e.flat, Note.a, Note.b]); | ||
|
||
final jehanAlain = | ||
const CryptogramScheme.frenchVariant().cryptogramOf('ALAIN'); | ||
expect(jehanAlain, [Note.a, Note.d, Note.a, Note.a, Note.f]); | ||
|
||
final johannesBrahms = | ||
const CryptogramScheme.german().cryptogramOf('BAHS'); | ||
expect(johannesBrahms, [Note.b.flat, Note.a, Note.b, Note.e.flat]); | ||
|
||
final johannSebastianBach = | ||
const CryptogramScheme.german().cryptogramOf('BACH'); | ||
expect(johannSebastianBach, [Note.b.flat, Note.a, Note.c, Note.b]); | ||
|
||
final johnCage = const CryptogramScheme.german().cryptogramOf('CAGE'); | ||
expect(johnCage, [Note.c, Note.a, Note.g, Note.e]); | ||
|
||
final josephHaydn = | ||
const CryptogramScheme.german().cryptogramOf('HAYDN'); | ||
expect(josephHaydn, [Note.b, Note.a, Note.d, Note.d, Note.g]); | ||
|
||
final metaAbegg = const CryptogramScheme.german().cryptogramOf('ABEGG'); | ||
expect(metaAbegg, [Note.a, Note.b.flat, Note.e, Note.g, Note.g]); | ||
|
||
final nielsGade = const CryptogramScheme.german().cryptogramOf('GADE'); | ||
expect(nielsGade, [Note.g, Note.a, Note.d, Note.e]); | ||
|
||
final paulSacher = | ||
const CryptogramScheme.german().cryptogramOf('SACHER'); | ||
expect( | ||
paulSacher, | ||
[Note.e.flat, Note.a, Note.c, Note.b, Note.e, Note.d], | ||
); | ||
|
||
final robertSchumann = | ||
const CryptogramScheme.german().cryptogramOf('SCHA'); | ||
expect(robertSchumann, [Note.e.flat, Note.c, Note.b, Note.a]); | ||
|
||
final asch1 = const CryptogramScheme.german().cryptogramOf('ASCH'); | ||
expect(asch1, [Note.a.flat, Note.c, Note.b]); | ||
|
||
final asch2 = const CryptogramScheme.german().cryptogramOf('A SCH'); | ||
expect(asch2, [Note.a, Note.e.flat, Note.c, Note.b]); | ||
}); | ||
}); | ||
|
||
group('.hashCode', () { | ||
test('should remove duplicates in a Set', () { | ||
final collection = { | ||
// ignore: prefer_const_constructors | ||
CryptogramScheme.french(), | ||
// ignore: prefer_const_constructors | ||
CryptogramScheme.frenchVariant(), | ||
// ignore: prefer_const_constructors | ||
CryptogramScheme.french(), | ||
}; | ||
expect(collection.length, 2); | ||
}); | ||
}); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
import 'alphabet_test.dart' as alphabet_test; | ||
import 'cryptogram_string_extension_test.dart' | ||
as cryptogram_string_extension_test; | ||
import 'cryptogram_scheme_test.dart' as cryptogram_scheme_test; | ||
import 'name_test.dart' as name_test; | ||
|
||
void main() { | ||
alphabet_test.main(); | ||
cryptogram_string_extension_test.main(); | ||
cryptogram_scheme_test.main(); | ||
name_test.main(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters