Files
BlockSeasons/test/game/models/season_test.dart
T
airkjw 41c18c8bdd Add AutoPlayer bot, stage generator CLI, and calibrated Season 1 (60 stages)
Greedy bot with tray-survival lookahead and gem-line steering; generator
samples layouts along a difficulty curve, probes bot moves-to-win, sets
adaptive move budgets targeting win-rate bands, and derives star
thresholds from spare-move quantiles. Season 1 pack bundled in assets
with per-stage difficulty report.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 13:56:54 +09:00

62 lines
1.6 KiB
Dart

import 'package:block_seasons/game/models/season.dart';
import 'package:flutter_test/flutter_test.dart';
const packJson = {
'schemaVersion': 1,
'seasonId': 'season_001',
'version': 2,
'title': {'en': 'First Bloom', 'ko': '첫 개화'},
'theme': {'tileSet': 'spring', 'background': 'background.webp'},
'stages': [
{
'id': 's001_001',
'seed': 101,
'moveLimit': 18,
'preset': [
{'x': 3, 'y': 3, 't': 'gem'},
],
'objectives': [
{'type': 'clearGems', 'count': 1},
],
'stars': {
'two': {'movesLeft': 4},
'three': {'movesLeft': 8},
},
'generatorProfile': 'easy',
},
],
};
void main() {
group('SeasonPack', () {
test('parses the pack schema', () {
final pack = SeasonPack.fromJson(packJson);
expect(pack.schemaVersion, 1);
expect(pack.seasonId, 'season_001');
expect(pack.version, 2);
expect(pack.theme.tileSet, 'spring');
expect(pack.stages, hasLength(1));
expect(pack.stages.first.id, 's001_001');
});
test('round-trips to JSON', () {
final pack = SeasonPack.fromJson(packJson);
expect(pack.toJson(), packJson);
});
test('localized title falls back to English', () {
final pack = SeasonPack.fromJson(packJson);
expect(pack.titleFor('ko'), '첫 개화');
expect(pack.titleFor('en'), 'First Bloom');
expect(pack.titleFor('ja'), 'First Bloom');
});
test('rejects unsupported schema versions', () {
expect(
() => SeasonPack.fromJson({...packJson, 'schemaVersion': 99}),
throwsFormatException,
);
});
});
}