halkyon/halkyon_learn_flutter/test/feature/kanji/model/hangul_test.dart

26 lines
1 KiB
Dart
Raw Normal View History

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);
});
}