From 3c5c5ef59088a96b7988652f2dfef3d8a771f464 Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 6 May 2024 18:44:09 -0500 Subject: implement consonant featural selection --- src/language.test.ts | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'src/language.test.ts') diff --git a/src/language.test.ts b/src/language.test.ts index d3c6f23..62b03a2 100644 --- a/src/language.test.ts +++ b/src/language.test.ts @@ -69,3 +69,73 @@ test('fail to output impossible consonants', () => { voice: false, })).toBe(''); }); + + +test('all consonants can be selected', () => { + expect(lang.pickConsonants( + [ lang.ConsonantPlace.Bilabial ], + [ lang.ConsonantManner.Nasal ], + [ true, true ], + )).toEqual([ + { + place: lang.ConsonantPlace.Bilabial, + manner: lang.ConsonantManner.Nasal, + voice: false, + }, + { + place: lang.ConsonantPlace.Bilabial, + manner: lang.ConsonantManner.Nasal, + voice: true, + }, + ]); + + expect(lang.pickConsonants( + [ lang.ConsonantPlace.Labiodental ], + [ + lang.ConsonantManner.Nasal, + lang.ConsonantManner.Plosive, + lang.ConsonantManner.SibilantAffricate, + lang.ConsonantManner.NonSibilantAffricate, + lang.ConsonantManner.SibilantFricative, + lang.ConsonantManner.NonSibilantFricative, + lang.ConsonantManner.Approximant, + lang.ConsonantManner.Tap, + lang.ConsonantManner.Trill, + lang.ConsonantManner.LateralAffricate, + lang.ConsonantManner.LateralFricative, + lang.ConsonantManner.LateralApproximant, + lang.ConsonantManner.LateralTap, + ], + [ true, false ], + )).toEqual([ + { + place: lang.ConsonantPlace.Labiodental, + manner: lang.ConsonantManner.Nasal, + voice: false, + }, + { + place: lang.ConsonantPlace.Labiodental, + manner: lang.ConsonantManner.Plosive, + voice: false, + }, + { + place: lang.ConsonantPlace.Labiodental, + manner: lang.ConsonantManner.NonSibilantAffricate, + voice: false, + }, + { + place: lang.ConsonantPlace.Labiodental, + manner: lang.ConsonantManner.NonSibilantFricative, + voice: false, + }, + ]); + + + expect(lang.pickConsonants( + [ lang.ConsonantPlace.Bilabial, lang.ConsonantPlace.Alveolar ], + [ lang.ConsonantManner.Plosive, lang.ConsonantManner.Tap ], + [ true, true ], + ).map(lang.consonantFeaturesToIpa)).toEqual([ + 'p', 'b', 'ⱱ̟', 't', 'd', 'ɾ̥', 'ɾ', + ]); +}); -- cgit v1.2.1