validate method

List<String> validate()

Validates the suite at construction time: ids unique, reference solutions present if required. Returns the list of problems (empty if valid).

Implementation

List<String> validate() {
  final problems = <String>[];
  if (!taskPassThreshold.isFinite ||
      taskPassThreshold < 0 ||
      taskPassThreshold > 1) {
    problems.add('taskPassThreshold must be finite and between 0.0 and 1.0');
  }
  final seen = <String>{};
  for (final t in tasks) {
    if (!seen.add(t.id)) {
      problems.add('duplicate task id "${t.id}"');
    }
    if (t.graders.isEmpty) {
      problems.add('task "${t.id}" has no graders');
    }
    if (requireReferenceSolution && t.referenceSolution == null) {
      problems.add('task "${t.id}" missing referenceSolution');
    }
    if (t.trialsPerRun <= 0) {
      problems.add('task "${t.id}" has trialsPerRun <= 0');
    }
  }
  return problems;
}