halkyon/apps/learn/halkyon_learn_curator/test/alphabets_test.dart
Tizian 「ティツィアーン」 649499be23
chore: Halkyon Learn moves into apps/learn
Its server, client, app and curator, and the tools that write its
assets (maps, Anki fixtures, icons), as they are; paths are fixed in
the commits that follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-10-22 18:11:02 +02:00

45 lines
1.6 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'dart:convert';
import 'package:halkyon_learn_curator/src/sources/alphabets.dart';
import 'package:test/test.dart';
void main() {
test('the Greek alphabet in its order, each letter with its capital, '
'names, transliteration and sound', () {
final [header, ...letters] = [
for (final line in greekAlphabet())
jsonDecode(line) as Map<String, Object?>,
];
expect(header['source'], 'greek-alphabet');
expect(header['kind'], 'characters');
expect(header['language'], 'el');
expect(letters, hasLength(24));
expect(letters.first['headword'], 'Α α');
final sigma = letters.singleWhere((letter) => letter['id'] == 'σ');
expect(sigma['headword'], 'Σ σ ς');
expect(sigma['keys'], containsAll(['ς', 'σίγμα', 'sigma', 's']));
expect(letters[1]['entry'], {
'romaji': 'v',
'script': 'greek',
'name': 'βήτα',
'englishName': 'beta',
'sound': 'v',
});
// Found by a name typed without its accent.
expect(letters.last['keys'], contains('ωμεγα'));
});
test('the Hangul letters in the order schools teach them, found by sound '
'and name', () {
final letters = hangulEntries();
expect(letters, hasLength(40));
expect(letters.first.headword, 'ㄱ');
expect(letters.first.keys, containsAll(['ㄱ', '기역', 'g', 'k']));
// ㅇ is silent opening a syllable: no key for its sound there.
final ieung = letters.singleWhere((letter) => letter.id == 'ㅇ');
expect(ieung.keys, ['ㅇ', '이응', 'ng']);
expect(letters.last.headword, 'ㅢ');
});
}