53 lines
1.8 KiB
Dart
53 lines
1.8 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
import 'package:words999/services/houses_service.dart';
|
|
import 'package:words999/services/words_repository.dart';
|
|
|
|
void main() {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
|
|
group('Archon Strict Noun Verification Tests', () {
|
|
late HousesService service;
|
|
late WordsRepository repo;
|
|
|
|
setUp(() async {
|
|
SharedPreferences.setMockInitialValues({});
|
|
repo = WordsRepository();
|
|
await repo.init(remoteDailyShuffle: false);
|
|
service = HousesService();
|
|
});
|
|
|
|
test('All 10 Archons are strictly nouns across 100 random sessions', () {
|
|
for (int run = 0; run < 100; run++) {
|
|
final session = service.createNewSession();
|
|
expect(session.sectors.length, 10);
|
|
for (int i = 0; i < 10; i++) {
|
|
final archon = session.sectors[i].archonWord;
|
|
expect(
|
|
archon.partOfSpeech.toLowerCase().trim(),
|
|
'существительное',
|
|
reason: 'Archon #${i + 1} «${archon.word}» is not a noun! (pos=${archon.partOfSpeech}, cat=${archon.category})',
|
|
);
|
|
expect(
|
|
archon.category.toLowerCase().contains('действие'),
|
|
isFalse,
|
|
reason: 'Archon «${archon.word}» has action category!',
|
|
);
|
|
expect(
|
|
archon.word.toLowerCase().trim(),
|
|
isNot(equals('положить')),
|
|
reason: '«положить» must never be an Archon!',
|
|
);
|
|
}
|
|
}
|
|
});
|
|
|
|
test('Word «положить» is strictly a verb in WordsRepository', () {
|
|
final w = repo.getWordByName('положить');
|
|
expect(w, isNotNull);
|
|
expect(w!.partOfSpeech.toLowerCase().trim(), 'глагол');
|
|
expect(w.category, contains('Действие'));
|
|
});
|
|
});
|
|
}
|