fix: 输入校验忽略多个连续空格与大小写;统一中英文引号与空白规范化

This commit is contained in:
shenlei
2026-09-16 17:55:08 +09:00
parent 4d324903b4
commit d72959df70
10 changed files with 163 additions and 28 deletions
@@ -84,6 +84,25 @@ void main() {
expect(dialogueTaskLabel(a0MeetDialogue, 9), '完成本轮任务');
});
test('输入校验忽略多余空格与大小写', () {
expect(
matchesDialogueStage(a0MeetDialogue, 0, " MY NAME IS SHEN "),
isTrue,
);
expect(
matchesDialogueStage(a0Dialogues["a0-02"]!, 1, " S H E N "),
isTrue,
);
expect(
matchesDialogueStage(a0Dialogues["a0-04"]!, 0, "MY NUMBER IS ONE-THREE-EIGHT"),
isTrue,
);
expect(
matchesDialogueStage(a0Dialogues["a0-08"]!, 2, "IT'S THREE O'CLOCK"),
isTrue,
);
});
test('给 AI 的可用词表随课程递增且不越界', () {
final first = taughtLanguageUpTo('a0-01');
final later = taughtLanguageUpTo('a0-09');
@@ -79,4 +79,31 @@ void main() {
isTrue,
);
});
test('ignores multiple spaces and casing across review items', () {
// Multi-space and uppercase on A0-P03
expect(
ReviewFeedback.check(
review('A0-P03', 'Nice to meet you.'),
' NICE TO MEET YOU! ',
).complete,
isTrue,
);
// Multi-space and uppercase on A0-P08
expect(
ReviewFeedback.check(
review('A0-P08', 'My number is ...'),
'MY NUMBER IS ONE TWO THREE',
).complete,
isTrue,
);
// Multi-space on word item
expect(
ReviewFeedback.check(
review('A0-W08', 'three'),
' THREE ',
).complete,
isTrue,
);
});
}
@@ -31,4 +31,31 @@ void main() {
isTrue,
);
});
test('ignores multiple spaces, mixed casing and curly apostrophes', () {
// a0-01 greeting and name with multiple spaces and uppercase
expect(
WritingFeedback.check('a0-01', ' HELLO I AM ALEX ').complete,
isTrue,
);
// a0-01 with curly quote and multiple spaces
expect(
WritingFeedback.check('a0-01', 'HI IM MIA').complete,
isTrue,
);
// a0-07 with multiple spaces in phrase
expect(
WritingFeedback.check('a0-07', 'THIS IS MY MOTHER').complete,
isTrue,
);
// a0-08-c with multiple spaces and curly apostrophe
expect(
WritingFeedback.check(
'a0-08-c',
'ITS THREE OCLOCK',
segmentId: 'a0-08-c',
).complete,
isTrue,
);
});
}