整个课程和数据UI重新设计版本
This commit is contained in:
@@ -1,29 +1,48 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:kouyu_english/core/a0_core.dart';
|
||||
import 'package:kouyu_english/core/courses/courses.dart';
|
||||
|
||||
import '../tool/courses/course_validator.dart';
|
||||
|
||||
void main() {
|
||||
test('tokenize expands contractions and skips digits', () {
|
||||
expect(tokenize("I'm Tom. Can't pay 15 dollars at 7 a.m.; let's go"), [
|
||||
'i', 'am', 'tom', 'can', 'not', 'pay', 'dollars', 'at', 'am', 'let',
|
||||
'us', 'go',
|
||||
'i',
|
||||
'am',
|
||||
'tom',
|
||||
'can',
|
||||
'not',
|
||||
'pay',
|
||||
'dollars',
|
||||
'at',
|
||||
'am',
|
||||
'let',
|
||||
'us',
|
||||
'go',
|
||||
]);
|
||||
});
|
||||
|
||||
test('match groups use AND across groups and OR inside a group', () {
|
||||
expect(satisfiesMatch("Sorry, I don't understand.", [
|
||||
['do not understand'],
|
||||
]), isTrue);
|
||||
expect(satisfiesMatch('twelvee', [
|
||||
['twelve'],
|
||||
]), isFalse);
|
||||
expect(satisfiesMatch('What is this word?', [
|
||||
['what does', 'what is'],
|
||||
['mean'],
|
||||
]), isFalse);
|
||||
expect(
|
||||
matchesRule("Sorry, I don't understand.", [
|
||||
['do not understand'],
|
||||
]),
|
||||
isTrue,
|
||||
);
|
||||
expect(
|
||||
matchesRule('twelvee', [
|
||||
['twelve'],
|
||||
]),
|
||||
isFalse,
|
||||
);
|
||||
expect(
|
||||
matchesRule('What is this word?', [
|
||||
['what does', 'what is'],
|
||||
['mean'],
|
||||
]),
|
||||
isFalse,
|
||||
);
|
||||
});
|
||||
|
||||
test('course packs pass validation', () {
|
||||
@@ -32,7 +51,7 @@ void main() {
|
||||
a0Texts: [
|
||||
for (final item in a0CoreItems.values)
|
||||
item.replaceAll(RegExp(r'\[[^\]]*\]'), ''),
|
||||
for (final sentence in a0DictationSentences.values) sentence.sentence,
|
||||
for (final sentence in coreDictationSentences.values) sentence.sentence,
|
||||
],
|
||||
).validate();
|
||||
expect(report.errors.map((issue) => '$issue'), isEmpty);
|
||||
|
||||
Reference in New Issue
Block a user