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>
This commit is contained in:
parent
11abd9afce
commit
649499be23
2 changed files with 0 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/kanji/model/hangul.dart';
|
||||
|
||||
void main() {
|
||||
test('a Hangul syllable is written with its letters: the opening '
|
||||
'consonant, the vowel and the closing one or cluster', () {
|
||||
expect(hangulLetters('가'), ['ㄱ', 'ㅏ']);
|
||||
expect(hangulLetters('닭'), ['ㄷ', 'ㅏ', 'ㄺ']);
|
||||
expect(hangulLetters('쓰'), ['ㅆ', 'ㅡ']);
|
||||
expect(hangulLetters('왜'), ['ㅇ', 'ㅙ']);
|
||||
expect(hangulLetters('힣'), ['ㅎ', 'ㅣ', 'ㅎ']);
|
||||
// What is no syllable stays as it is.
|
||||
expect(hangulLetters('ㄱ'), ['ㄱ']);
|
||||
expect(hangulLetters('食'), ['食']);
|
||||
});
|
||||
|
||||
test('scripts whose strokes are drawn: Han characters, kana, Hangul; '
|
||||
'not the alphabets', () {
|
||||
expect(hasDrawnScript('食べる'), isTrue);
|
||||
expect(hasDrawnScript('学习'), isTrue);
|
||||
expect(hasDrawnScript('학교'), isTrue);
|
||||
expect(hasDrawnScript('ㄱ'), isTrue);
|
||||
expect(hasDrawnScript('das Haus'), isFalse);
|
||||
expect(hasDrawnScript('Β β'), isFalse);
|
||||
});
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_learn_flutter/src/feature/kanji/model/radical.dart';
|
||||
|
||||
void main() {
|
||||
test('the 214 Kangxi radicals in their order, by their strokes from 1 '
|
||||
'to 17', () {
|
||||
expect(
|
||||
[for (final radical in radicals) radical.number],
|
||||
[
|
||||
for (var number = 1; number <= 214; number++) number,
|
||||
],
|
||||
);
|
||||
final strokes = [for (final radical in radicals) radical.strokes];
|
||||
expect(strokes, orderedEquals([...strokes]..sort()));
|
||||
expect((strokes.first, strokes.last), (1, 17));
|
||||
// Const, as the table is: a record compares its lists by identity.
|
||||
expect(radicals[84], const (
|
||||
number: 85,
|
||||
character: '水',
|
||||
variants: ['氵'],
|
||||
strokes: 4,
|
||||
name: 'water',
|
||||
));
|
||||
});
|
||||
|
||||
test('each is one character, as is every form it takes in kanji', () {
|
||||
for (final radical in radicals) {
|
||||
for (final form in [radical.character, ...radical.variants]) {
|
||||
expect(form.runes, hasLength(1), reason: '${radical.number}');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("a radical's label is the dictionary's", () {
|
||||
expect(radicalLabel(85), 'radical:85');
|
||||
});
|
||||
|
||||
test('the forms a radical takes in each language: simplified Chinese its '
|
||||
"own, traditional Chinese and Korean without Japanese's own", () {
|
||||
final speech = radicals[148];
|
||||
final dragon = radicals[211];
|
||||
final food = radicals[183];
|
||||
expect(radicalFormsIn(speech, 'zh-Hans'), ['讠']);
|
||||
expect(radicalFormsIn(speech, 'zh-Hant'), isEmpty);
|
||||
expect(radicalFormsIn(dragon, 'ja'), ['竜']);
|
||||
expect(radicalFormsIn(dragon, 'zh'), ['龙']);
|
||||
expect(radicalFormsIn(dragon, 'ko'), isEmpty);
|
||||
// Simplified Chinese writes 食 as 饣 at a character's side, not 飠.
|
||||
expect(radicalFormsIn(food, 'zh-CN'), ['饣']);
|
||||
expect(radicalFormsIn(food, 'zh-TW'), ['飠']);
|
||||
expect(radicalsIn('zh-Hans')[148].variants, ['讠']);
|
||||
// Each form once, never the radical itself.
|
||||
expect(radicalFormsIn(radicals[198], 'zh'), ['麦']);
|
||||
expect(radicalFormsIn(radicals[202], 'zh'), isEmpty);
|
||||
expect((hasRadicals('ko'), hasRadicals('el')), (true, false));
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue