feat: complete kouyu_english app codebase, A0 specifications and .gitignore

This commit is contained in:
shen
2026-09-15 15:58:33 +08:00
parent b8072673d8
commit 37c86f7ecb
136 changed files with 19042 additions and 0 deletions
@@ -0,0 +1,82 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:kouyu_english/core/models.dart';
import 'package:kouyu_english/core/review_feedback.dart';
ReviewItem review(String id, String target) => ReviewItem(
id: id,
target: target,
prompt: 'Test prompt',
hint: target,
dueAt: DateTime(2026),
skill: '回忆表达',
);
void main() {
test('does not accept unrelated English for a core phrase', () {
final result = ReviewFeedback.check(
review('A0-P12', "I'm from [place]."),
'I like tea.',
);
expect(result.complete, isFalse);
});
test('accepts a new place in the from pattern', () {
final result = ReviewFeedback.check(
review('A0-P12', "I'm from [place]."),
"I'm from Guangzhou.",
);
expect(result.complete, isTrue);
});
test('checks an A0 word without accepting a different word', () {
expect(
ReviewFeedback.check(review('A0-W08', 'three'), 'four').complete,
isFalse,
);
expect(
ReviewFeedback.check(review('A0-W08', 'three'), 'three').complete,
isTrue,
);
});
test('A0-P17 accepts standard o clock expressions', () {
expect(
ReviewFeedback.check(
review('A0-P17', "It's [hour] o'clock."),
"It's three o'clock.",
).complete,
isTrue,
);
expect(
ReviewFeedback.check(
review('A0-P17', "It's [hour] o'clock."),
'It is two o’clock.',
).complete,
isTrue,
);
expect(
ReviewFeedback.check(
review('A0-P17', "It's [hour] o'clock."),
'It is five oclock.',
).complete,
isTrue,
);
});
test('A0-P20 accepts please say that again and please speak slowly', () {
expect(
ReviewFeedback.check(
review('A0-P20', 'Please say that again.'),
'Please say that again.',
).complete,
isTrue,
);
expect(
ReviewFeedback.check(
review('A0-P20', 'Please say that again.'),
'Please speak slowly.',
).complete,
isTrue,
);
});
}